Add HTMLElement to the getTag() return type

pull/1381/head
nathan 2023-08-18 09:17:02 -06:00
rodzic b2f6499b87
commit 621aa4362b
2 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -458,7 +458,8 @@ const App = () => (
### Custom Tags
When multiple options can be selected, you can provide custom tags by passing a function to the `getTag` property.
Your `getTag(option, index)` function can return a string or a Lit <a href="https://lit.dev/docs/templates/overview/">Template</a>
Your `getTag(option, index)` function can return a string, a Lit <a href="https://lit.dev/docs/templates/overview/">Template</a>,
or an HTMLElement.
```html:preview
<sl-select placeholder="Select" value="option-1 option-2" class="custom-tag" multiple clearable>

Wyświetl plik

@ -178,7 +178,7 @@ export default class SlSelect extends ShoelaceElement implements ShoelaceFormCon
* is the current tag's index. The function should return either a Lit TemplateResult or a string containing trusted HTML of the symbol to render at
* the specified value.
*/
@property() getTag: (option: SlOption, index: number) => TemplateResult | string = option => {
@property() getTag: (option: SlOption, index: number) => TemplateResult | string | HTMLElement = option => {
return html`
<sl-tag
part="tag"