From 453ac707b9c96b8d9e6f70075ed99ce1f621bc0e Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Sat, 19 Mar 2022 09:05:46 -0700 Subject: [PATCH] docs(multi-select): add "Custom slot" example --- docs/src/pages/components/MultiSelect.svx | 6 ++++ .../framed/MultiSelect/MultiSelectSlot.svelte | 33 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 docs/src/pages/framed/MultiSelect/MultiSelectSlot.svelte diff --git a/docs/src/pages/components/MultiSelect.svx b/docs/src/pages/components/MultiSelect.svx index 6af4b4dd..5936cebd 100644 --- a/docs/src/pages/components/MultiSelect.svx +++ b/docs/src/pages/components/MultiSelect.svx @@ -13,6 +13,12 @@ By default, items will be ordered alphabetically based on the `item.text` value. {id: "2", text: "Fax"}]}" /> +### Custom slot + +Override the default slot to customize the display of each item. Access the item and index through the `let:` directive. + + + ### No alphabetical ordering To prevent alphabetical item ordering, pass an empty function to the `sortItem` prop. diff --git a/docs/src/pages/framed/MultiSelect/MultiSelectSlot.svelte b/docs/src/pages/framed/MultiSelect/MultiSelectSlot.svelte new file mode 100644 index 00000000..96d591b0 --- /dev/null +++ b/docs/src/pages/framed/MultiSelect/MultiSelectSlot.svelte @@ -0,0 +1,33 @@ + + + +
+ {item.text} +
+
+ id: {item.id} - index: + {index} +
+
+ +