Chip Group
Группа чипов с иконками: один или несколько вариантов. Бесплатно, MIT · Формы и ввод › Выбор из списка
Установка
npx valyro-cli@latest add chip-group
npx shadcn@latest add https://valyro.xyz/r/chip-group.json
npm install valyro-ui
import 'valyro-ui/styles.css';
import { ChipGroup } from 'valyro-ui';
Пропсы
| Prop | Type | Default | |
|---|---|---|---|
items | ChipGroupItem[] | The chips, in order. Or compose them as children: ChipGroup.Item. | |
children | ReactNode | The compound form instead of items: ChipGroup.Item elements. | |
selectionMode | 'single' | 'multiple' | 'multiple' | multiple: any number of chips (checkboxes); single: one at a time (radios). Default multiple. |
value | string[] | Selected values (controlled). | |
defaultValue | string[] | Initial value when uncontrolled. | |
onValueChange | (value: string[]) => void | Called with the new value when it changes. | |
name | string | Name of the native inputs, so the selection submits with a form. | |
size | 'sm' | 'md' | 'lg' | 'md' | Chip height and text size. Default md. |
variant | 'soft' | 'outline' | 'soft' | soft: filled chips; outline: bordered chips. Default soft. |
disabled | boolean | false | Disables every chip. |
label | ReactNode | Visible name above the chips, linked to the group. Outside a FormField a group needs a name (this, or an aria-label / aria-labelledby); inside one, the field's label names it. | |
invalid | boolean | false | Error state, e.g. from a FormField: aria-invalid on the group and a danger edge on the chips. |
Составные части
ChipGroup.Item (ChipGroupItemPart)
Похожие компоненты
- Select — Выбор из списка
- Multi Select — Множественный выбор
- Combobox — Поиск и выбор
- Listbox — Список вариантов на странице: один или несколько, диапазоны с Shift
- Checkbox Tree — Дерево с чекбоксами: каскад, частичная отметка, клавиатура
- Text Input — Текстовые поля
- Textarea — Многострочный ввод
- Search Input — Поисковая строка
- Mentions Input — Текст с @упоминаниями и #тегами, асинхронные подсказки
- Tags Input — Ввод тегов
- Checkbox — Флажки
- Checkbox Group — Флажки с общей подписью, подсказкой, ошибкой и обязательностью
Назад: Listbox · Далее: Checkbox Tree · Весь раздел «Формы и ввод»