Multi Select
stableLets users choose multiple options from a searchable dropdown list.
Basic usage
Examples
Controlled with max selection
Track selected values externally and cap the selection count.
Selected: react
Selected chips and overflow
Selected values render in the trigger and can collapse into an overflow count.
Features
- Can be controlled or uncontrolled.
- Shows selected values in the trigger.
- Supports search, creation and virtualized option rendering.
- Keeps the listbox open while toggling options.
Installation
pnpm dlx structyl add multi-selectAPI Reference
MultiSelect.Root
Contains all multi-select parts.
| Prop | Type | Default |
|---|---|---|
| value | string[]Controlled selected values. | — |
| defaultValue | string[]Initial selected values. | — |
| onValueChange | (value: string[]) => voidCalled when selected values change. | — |
| open | booleanControlled open state. | — |
| onOpenChange | (open: boolean) => voidCalled when open state changes. | — |
| disabled | booleanDisable the multi-select. | false |
| required | booleanMark as required. | false |
| name | stringName for form submission. | — |
| searchable | booleanEnable option search. | false |
| onCreateOption | (value: string) => voidCalled when a new option is created. | — |
MultiSelect.Trigger
The button that opens the listbox.
| Prop | Type | Default |
|---|---|---|
| className | stringAdditional Tailwind classes, merged with the component defaults. | — |
MultiSelect.Value
Displays selected values inside the trigger.
| Prop | Type | Default |
|---|---|---|
| placeholder | ReactNodeShown when no value is selected. | — |
| options | MultiSelectOption[]Used to resolve selected value labels. | — |
| maxVisible | numberStyled wrapper limit before showing an overflow count. | — |
MultiSelect.SearchInput
Search field shown when the root is searchable.
| Prop | Type | Default |
|---|---|---|
| className | stringAdditional Tailwind classes, merged with the component defaults. | — |
MultiSelect.Content
The multi-selectable listbox popup.
| Prop | Type | Default |
|---|---|---|
| options | MultiSelectOption[]Array-backed options rendered with windowing. | — |
| optionHeight | numberVirtual row height in pixels. | 36 |
| optionOverscan | numberExtra rows rendered above and below the viewport. | 6 |
MultiSelect.Item
A toggleable option.
| Prop | Type | Default |
|---|---|---|
| value | stringThe value toggled when selected. | — |
| disabled | booleanDisable the option. | false |
| textValue | stringOverride the search text. | — |
MultiSelect.CreateItem
Creates and selects the current search text with `onCreateOption`.
| Prop | Type | Default |
|---|---|---|
| className | stringAdditional Tailwind classes, merged with the component defaults. | — |
MultiSelect.Options
Virtualized renderer for large array-backed option lists.
| Prop | Type | Default |
|---|---|---|
| options | MultiSelectOption[]Options to render. | — |
| itemHeight | numberRow height in pixels. | 36 |
| overscan | numberExtra rows rendered outside the viewport. | 6 |
MultiSelect.Group
Groups related items.
| Prop | Type | Default |
|---|
MultiSelect.Label
A group label.
| Prop | Type | Default |
|---|
MultiSelect.Separator
A visual divider.
| Prop | Type | Default |
|---|
Keyboard interactions
Adheres to the WAI-ARIA design pattern .
| Key | Description |
|---|---|
| Space / Enter | Opens the multi-select / toggles the focused item. |
| ArrowDown / ArrowUp | Moves focus between options. |
| Esc | Closes the multi-select. |