ValyroUI Русская версия

Multi Select

Pick several options. Free, MIT · Forms and input › Selects

Multi-value select: chips in the field, checkboxes in the list. className and style go to the field wrapper; ref and other props to the combobox trigger button. Chip remove buttons follow the trigger in Tab order; Backspace on the trigger removes the last value. While the list is open, Tab moves into its "Clear all" button.

Installation

npx valyro-cli@latest add multi-select
npx shadcn@latest add https://valyro.xyz/r/multi-select.json
npm install valyro-ui

import 'valyro-ui/styles.css';
import { MultiSelect } from 'valyro-ui';

Props

PropTypeDefault
optionsSelectItem[]Options to pick from, flat or in labelled groups. Or compose them as children: MultiSelect.Item, .Group, .Empty.
childrenReactNodeThe compound form instead of options: MultiSelect.Item, MultiSelect.Group and MultiSelect.Empty elements.
valuestring[]Selected values in the order they were picked.
defaultValuestring[]Initial value when uncontrolled.
onValueChange(value: string[]) => voidCalled with the new value when it changes.
openbooleanControlled open; use with onOpenChange.
defaultOpenbooleanInitial open when uncontrolled.
onOpenChange(open: boolean) => voidCalled with the new open when it changes.
placeholderstring'Select…'Field text while nothing is selected.
size'sm' | 'md' | 'lg''md'Field height and text size.
invalidbooleanfalseError border and aria-invalid on the trigger (an explicit aria-invalid wins).
searchablebooleanfalseAdds a filter box at the top of the popover.
searchPlaceholderstring'Search…'Placeholder and accessible name of the filter box.
maxChipsnumber | 'auto'2Chips shown in the field before collapsing the rest into "+N". 'auto': as many whole chips as the field's width holds (measured again when it resizes), so chips are never squeezed into a few letters.
emptyTextReactNodeShown in the popover when no option matches the filter or options is empty. Or MultiSelect.Empty.
labelsPartial<MultiSelectLabels>Overrides for the built-in English text; keys left out keep their defaults.
namestringSubmits every selected value with the surrounding form (one hidden input per value).

Compound parts

MultiSelect.Item (MultiSelectItem), MultiSelect.Group (MultiSelectGroup), MultiSelect.Empty (MultiSelectEmpty)

Related components

Previous: Select · Next: Combobox · All Forms and input