ReactTailwind CSS
Installation
$ pnpm dlx shadcn@latest add @synccn/multi-selectFirst time in this project? Connect synccn with one command.
Usage
import { MultiSelect } from "@/components/ui/multi-select";<MultiSelect options={skills} max={5} />API reference
Generated from the component's TypeScript types, so it always matches the code.
MultiSelect
Pick several options from a searchable list; selections show as removable chips.
PropTypeDescription
- optionsrequired
{ value: string; label: string }[]Choices.
- value
string[]Controlled selection.
- defaultValue
string[]Default
[]Initial selection when uncontrolled.
- onValueChange
(value: string[]) => voidCalled with the new selection.
- placeholder
stringDefault
"Select options"Shown when nothing is selected.
- max
numberMost items that can be picked.
- maxChips
numberDefault
3Chips shown before “+N more”.
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
Helpers
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for Check, ChevronDown, X
Keyboard
- EnterorSpaceor↓Open the list
- ↓or↑Move between options
- EnterAdd or remove the highlighted option
- EscClose the list
Accessibility
- Each chosen chip has its own remove button with an accessible label.
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA roles: combobox, listbox, option
- ARIA attributes: aria-disabled, aria-expanded, aria-label, aria-multiselectable, aria-selected
- Keys handled: ArrowUp, ArrowDown, Enter, Space
- Closes with Escape
- Closes when you click or tap outside
- Flips to whichever side has room, so it stays on screen
- Shows a visible focus ring for keyboard users
More inputs
ButtonSeven variants, four sizes and a built-in loading state.InputText field with optional leading icon and invalid state.TextareaMulti-line field that grows with its content and counts characters.CheckboxChecked, unchecked and indeterminate, with label and description.SwitchToggle with a springy thumb in three sizes.Radio GroupPick one option, shown as dots or as selectable cards.