diff --git a/docs/src/pages/components/MultiSelect.svx b/docs/src/pages/components/MultiSelect.svx index 9d38c548..64769648 100644 --- a/docs/src/pages/components/MultiSelect.svx +++ b/docs/src/pages/components/MultiSelect.svx @@ -3,7 +3,7 @@ import Preview from "../../components/Preview.svelte"; -`MultiSelect` is keyed for performance reasons. +The `MultiSelect` component provides a dropdown interface for selecting multiple options using checkboxes. It supports filtering, custom formatting, and various states. Each item must have a unique `id` property for proper functionality.
Every items object must have a unique "id" property.
@@ -11,12 +11,7 @@ ## Default -By default, items will be ordered alphabetically based on the `item.text` value. -To prevent this, see [#no-alphabetical-ordering](#no-alphabetical-ordering). - -MultiSelect provides interactivity for a list of checkbox inputs. Those -checkboxes will remain rendered in the DOM and are submittable within forms. -Checkbox attributes can be adjusted via the `itemToInput` prop. +Create a basic multi-select dropdown with three contact methods. By default, items are ordered alphabetically. { return item.text + ' (' + item.id +')' @@ -39,15 +34,13 @@ Use the `itemToString` prop to format the display of individual items without mo ## Custom slot -For even more customization, use the default slot. - -Access the `item` and `index` values through the `let:` directive. +Override the default slot to customize item rendering. This example shows how to access and use the item and index values. ## No alphabetical ordering -To prevent alphabetical item ordering, pass a noop function to the `sortItem` prop. +Prevent automatic alphabetical ordering by passing a no-op function to `sortItem`. This maintains the original order of items. ## Format checkbox values +Customize checkbox attributes using the `itemToInput` prop. This example sets a consistent name for all checkboxes. + Use the `itemToInput` prop to customize the user-selectable checkbox values. This will also override the underlying hidden inputs used for form submission. -For example: - ```js -(item) => ({name: `Contact_${item.id}`], value: item.id}) - - +itemToInput={(item) => { + return { + name: `Contact_${item.id}`, + value: item.id + } +}} ``` The above function sets the `name` attribute to @@ -112,7 +108,7 @@ renders, along with each respective item's `id` set to the `value` attribute. ## Top direction -Set `direction` to `"top"` for the dropdown menu to appear above the input. +Display the dropdown menu above the input by setting `direction` to `"top"`. This is useful when space below is limited.