From 402a00dcd3fa0cfab6ef7d9007719eaaa86be640 Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Fri, 18 Aug 2023 12:05:22 -0400 Subject: [PATCH] update docs --- cspell.json | 1 + docs/pages/components/select.md | 63 +++++++++++++++------------------ 2 files changed, 30 insertions(+), 34 deletions(-) diff --git a/cspell.json b/cspell.json index 1ae87336..028a6267 100644 --- a/cspell.json +++ b/cspell.json @@ -160,6 +160,7 @@ "unbundles", "unbundling", "unicons", + "unsanitized", "unsupportive", "valpha", "valuenow", diff --git a/docs/pages/components/select.md b/docs/pages/components/select.md index 87256381..4705dc07 100644 --- a/docs/pages/components/select.md +++ b/docs/pages/components/select.md @@ -457,55 +457,50 @@ 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, a Lit Template, -or an HTMLElement. +When multiple options can be selected, you can provide custom tags by passing a function to the `getTag` property. Your function can return a string of HTML, a Lit Template, or an [`HTMLElement`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement). The `getTag()` function will be called for each option. The first argument is an `` element and the second argument is the tag's index (its position in the tag list). + +Remember that custom tags are rendered in a shadow root. To style them, you can use the `style` attribute in your template or you can add your own [parts](/getting-started/customizing/#css-parts) and target them with the [`::part()`](https://developer.mozilla.org/en-US/docs/Web/CSS/::part) selector. ```html:preview - - + + Email - - - + Phone - - - + Chat - - Option 4 - Option 5 - + ``` + +:::warning +Be sure you trust the content you are outputting! Passing unsanitized user input to `getTag()` can result in XSS vulnerabilities. +:::