ValyroUI English version

Radio Group

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

Установка

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

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

Пропсы

PropTypeDefault
optionsRadioGroupOption[]Radios in order, each with a label and an optional description. Or compose them as children: RadioGroup.Item.
childrenReactNodeThe compound form instead of options: RadioGroup.Item elements.
valuestringControlled value; use with onValueChange.
defaultValuestringInitial value when uncontrolled.
onValueChange(value: string) => voidCalled with the new value when it changes.
namestringName of the native radios (generated when omitted).
orientation'vertical' | 'horizontal''vertical'Stack options in a column or lay them out in a row.
variant'default' | 'cards''default'cards renders each option as a selectable bordered card.
size'sm' | 'md' | 'lg''md'Radio and text size.
disabledbooleanfalseDisables every option.
invalidbooleanfalseError color on the radios and aria-invalid on the group.
requiredbooleanMarks the group aria-required and makes a choice mandatory for native form validation.
animation'default' | 'spring''default'spring: the chosen dot pops in with a bounce and the ring pulses. default: the theme's transition.
labelReactNodeVisible name above the options, linked to the group. Outside a FormField a group needs a name (this, or an aria-label / aria-labelledby), or a screen reader reads the options with no question.

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

RadioGroup.Item (RadioGroupItem)

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

  • Checkbox — Флажки
  • Checkbox Group — Флажки с общей подписью, подсказкой, ошибкой и обязательностью
  • Switch — Переключатель
  • Slider — Ползунок
  • Histogram Range — Диапазон цен с гистограммой, двумя ползунками и полями
  • Rating Input — Оценка звёздами
  • Text Input — Текстовые поля
  • Textarea — Многострочный ввод
  • Search Input — Поисковая строка
  • Mentions Input — Текст с @упоминаниями и #тегами, асинхронные подсказки
  • Tags Input — Ввод тегов
  • Select — Выбор из списка

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