ValyroUI English version

Multi Select

Множественный выбор. Бесплатно, MIT · Формы и ввод › Выбор из списка

Установка

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';

Пропсы

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

Составные части

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

Похожие компоненты

  • Select — Выбор из списка
  • Combobox — Поиск и выбор
  • Listbox — Список вариантов на странице: один или несколько, диапазоны с Shift
  • Chip Group — Группа чипов с иконками: один или несколько вариантов
  • Checkbox Tree — Дерево с чекбоксами: каскад, частичная отметка, клавиатура
  • Text Input — Текстовые поля
  • Textarea — Многострочный ввод
  • Search Input — Поисковая строка
  • Mentions Input — Текст с @упоминаниями и #тегами, асинхронные подсказки
  • Tags Input — Ввод тегов
  • Checkbox — Флажки
  • Checkbox Group — Флажки с общей подписью, подсказкой, ошибкой и обязательностью

Назад: Select · Далее: Combobox · Весь раздел «Формы и ввод»