diff --git a/docs/src/pages/components/Dropdown.svx b/docs/src/pages/components/Dropdown.svx index 477fcce9..afd5cee2 100644 --- a/docs/src/pages/components/Dropdown.svx +++ b/docs/src/pages/components/Dropdown.svx @@ -7,7 +7,9 @@ components: ["Dropdown", "DropdownSkeleton"] import Preview from "../../components/Preview.svelte"; -`Dropdown` is keyed for performance reasons. +The `Dropdown` component provides a select input with a dropdown menu. It supports +various states, sizes, and customization options. Each item in the dropdown must +have a unique `id` property for proper functionality.
Every items object must have a unique "id" property.
@@ -15,25 +17,33 @@ components: ["Dropdown", "DropdownSkeleton"] ## Default +Use the `Dropdown` component to create a select input with a dropdown menu. Each item +must have a unique `id` property. + ## Custom slot -Override the default slot to customize the display of each item. Access the item and index through the `let:` directive. +Override the default slot to customize the display of each item. Access the item and +index through the `let:` directive. ## Hidden label +Hide the label while maintaining accessibility by setting the `hideLabel` prop to +`true`. The label will still be available to screen readers. + ## Format item display text -Use the `itemToString` prop to format the display of individual items. +Format the display text of items using the `itemToString` prop. This function +receives the item object and returns the formatted string. { return item.text + ' (' + item.id +')' @@ -43,11 +53,15 @@ Use the `itemToString` prop to format the display of individual items. ## Multiple dropdowns +Create multiple dropdowns that work together. This example demonstrates how to +manage the state of multiple dropdowns. + ## Top direction -Set `direction` to `"top"` for the dropdown menu to appear above the input. +Display the dropdown menu above the input by setting the `direction` prop to +`"top"`. This is useful when there's limited space below the input. ## Inline variant +Display the dropdown inline with other content by setting the `type` prop to +`"inline"`. This variant removes the background and border. + ## Extra-large size +Increase the size of the dropdown by setting the `size` prop to `"xl"`. This +provides more visual emphasis for important selections. + ## Small size +Decrease the size of the dropdown by setting the `size` prop to `"sm"`. This is +useful for compact layouts or secondary selections. + ## Invalid state +Indicate an invalid selection by setting the `invalid` prop to `true`. Provide +feedback to users with the `invalidText` prop. + ## Warning state +Indicate a warning state by setting the `warn` prop to `true`. Provide additional +context with the `warnText` prop. + ## Disabled state +Disable the entire dropdown by setting the `disabled` prop to `true`. This prevents +user interaction with the component. + ## Disabled items -Use the `disabled` property in the `items` prop to disable specific items. +Disable specific items in the dropdown by setting the `disabled` property to +`true` in the item object. This allows for more granular control over available +selections. \ No newline at end of file