Pick several options from a searchable list, shown as chips in the field.
Type to filter, pick with a click or Enter, and keep picking: the list stays open and the search clears after each pick. Every pick becomes a chip in the field. Remove one with its button, or with Backspace in an empty search.
Multi Select is part of the Fabricator style. It's built on React Aria's ComboBox with selectionMode="multiple", which owns filtering, the keyboard and ARIA, and it shares Combobox's frame, popup and rows. Chips pop in with a small rise, fade and wipe out where they stand while the chips after them glide over. One highlight glides between options and the check scales in on the picked ones. Motion follows the motion speed and stops under reduced motion.
Installation#
bunx --bun fabricator-ui@latest add multi-select
Usage#
import {
MultiSelect,
MultiSelectContent,
MultiSelectEmpty,
MultiSelectInput,
MultiSelectItem,
MultiSelectList,
MultiSelectTrigger,
MultiSelectValue,
} from "@/components/ui/multi-select"const frameworks = ["Next.js", "Remix", "Astro", "SvelteKit"]
<MultiSelect aria-label="Frameworks">
<MultiSelectTrigger>
<MultiSelectValue />
<MultiSelectInput placeholder="Add frameworks" />
</MultiSelectTrigger>
<MultiSelectContent>
<MultiSelectList
renderEmptyState={() => (
<MultiSelectEmpty>No frameworks found.</MultiSelectEmpty>
)}
>
{frameworks.map((framework) => (
<MultiSelectItem key={framework} id={framework}>
{framework}
</MultiSelectItem>
))}
</MultiSelectList>
</MultiSelectContent>
</MultiSelect>Composition#
MultiSelect ComboBox, always `selectionMode="multiple"`
├── Label optional, e.g. FieldLabel
├── MultiSelectTrigger the field: Group
│ ├── MultiSelectValue a chip per picked item
│ │ └── chip + remove button
│ ├── MultiSelectInput the search, a combobox input
│ └── chevron
└── MultiSelectContent the popover, anchored to the field
└── MultiSelectList ListBox
├── MultiSelectItem ListBoxItem
└── MultiSelectGroup ListBoxSection, with MultiSelectLabelThe value is the picked items' ids. A chip shows the item's text (its string child or textValue); pass children to MultiSelectValue to draw it yourself from the item's value.
React 19.2 in development throws when a React Aria ComboBox list with sections is filtered (react#35126); production builds are fine. Until React ships the fix, prefer a flat list on this base.
Examples#
Field#
Put a FieldLabel inside MultiSelect and React Aria links it to the search.
Pick every language the role uses. Backspace removes the last one.
Controlled#
Control the picks with value and onChange. Setting value from outside animates the chips too.
2 selected
Invalid#
Set isInvalid on MultiSelect and data-invalid on the Field.
Disabled#
API Reference#
MultiSelect#
Every ComboBox prop except selectionMode, which is always "multiple".
| Prop | Type | Default |
|---|---|---|
value | Key[] | - |
defaultValue | Key[] | - |
onChange | (value: Key[]) => void | - |
isDisabled | boolean | false |
isInvalid | boolean | false |
name | string | - |
The search clears after each pick and onInputChange reports it.
MultiSelectValue#
| Prop | Type | Default |
|---|---|---|
children | (item: T) => ReactNode | the item text |
Data attributes#
| Attribute | Element | Present when |
|---|---|---|
data-slot="multi-select-trigger" | the field | always |
data-slot="multi-select-chip" | each chip | an item is picked |
data-exiting | a chip | it's leaving |
data-slot="multi-select-chip-remove" | a chip's button | an item is picked |
data-slot="multi-select-input" | the search | always |
data-slot="multi-select-content" | the popover | open |
data-slot="multi-select-item" | each option | open |
data-selected | an option | it's picked |
Accessibility#
- The search is a
comboboxinput. Label it with aLabelinsideMultiSelectoraria-label; the list isaria-multiselectable. - Up and Down move through the options, Enter picks or unpicks, and Escape closes. Typing filters.
- Backspace in an empty search removes the last chip.
- Each remove button is a button in the tab order, named "Remove" and the item's text. A leaving chip is hidden from assistive technology and can't be pressed.
- Clicking anywhere on the field focuses the search and opens the list.