Search documentation

Search pages, components, blocks, styles and colours.

Get started
Skip to content

Multi Select

PreviousNext

Pick several options from a searchable list, shown as chips in the field.

Design
Engineering

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 MultiSelectLabel

The 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.

TypeScript

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.

Bug
Performance

2 selected

Invalid

Set isInvalid on MultiSelect and data-invalid on the Field.

Disabled

Lisbon
Berlin

API Reference

MultiSelect

Every ComboBox prop except selectionMode, which is always "multiple".

PropTypeDefault
valueKey[]-
defaultValueKey[]-
onChange(value: Key[]) => void-
isDisabledbooleanfalse
isInvalidbooleanfalse
namestring-

The search clears after each pick and onInputChange reports it.

MultiSelectValue

PropTypeDefault
children(item: T) => ReactNodethe item text

Data attributes

AttributeElementPresent when
data-slot="multi-select-trigger"the fieldalways
data-slot="multi-select-chip"each chipan item is picked
data-exitinga chipit's leaving
data-slot="multi-select-chip-remove"a chip's buttonan item is picked
data-slot="multi-select-input"the searchalways
data-slot="multi-select-content"the popoveropen
data-slot="multi-select-item"each optionopen
data-selectedan optionit's picked

Accessibility

  • The search is a combobox input. Label it with a Label inside MultiSelect or aria-label; the list is aria-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.