ValyroUI English version

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

Пропсы

PropTypeDefault
itemsChipGroupItem[]The chips, in order. Or compose them as children: ChipGroup.Item.
childrenReactNodeThe 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.
valuestring[]Selected values (controlled).
defaultValuestring[]Initial value when uncontrolled.
onValueChange(value: string[]) => voidCalled with the new value when it changes.
namestringName 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.
disabledbooleanfalseDisables every chip.
labelReactNodeVisible 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.
invalidbooleanfalseError 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 · Весь раздел «Формы и ввод»