ValyroUI English version

Toggle Group

Кнопки-переключатели: форматирование, выравнивание, фильтры. Бесплатно, MIT · Навигация и каркас › Переключение

Установка

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

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

Пропсы

PropTypeDefault
itemsreadonly ToggleGroupOption[]The buttons in order. Or compose them as children: ToggleGroup.Item.
childrenReactNodeThe compound form instead of items: ToggleGroup.Item elements.
typeMsingle: at most one pressed (alignment); multiple: any number (bold, italic, underline).
valueToggleGroupValue<M>The pressed value (single, null for none) or values (multiple).
defaultValueToggleGroupValue<M>Initial value when uncontrolled.
onValueChange(value: ToggleGroupValue<M>) => voidCalled with the new value when it changes.
allowEmptybooleantruesingle: pressing the pressed button releases it.
orientation'horizontal' | 'vertical''horizontal'A row or a column; arrow keys follow it.
loopbooleantrueArrow keys wrap from the last button to the first.
disabledbooleanfalseDisables every button.
attachedbooleantrueJoined into one control on a shared track; false spaces the buttons apart and lets the row wrap.
size'sm' | 'md' | 'lg''md'Button height and text size.
indicatorbooleanfalsesingle: one pressed fill slides between the buttons instead of each button filling on its own.
labelsPartial<ToggleGroupLabels>Overrides for the built-in English text; keys left out keep their defaults.

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

ToggleGroup.Item (ToggleGroupItem)

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

  • Tabs — Вкладки
  • Segmented Control — Переключатель режимов
  • Pagination — Постраничная навигация
  • Stepper — Пошаговые процессы
  • App Shell — Каркас приложения
  • Navbar — Верхняя навигация
  • Sidebar — Боковая панель
  • Resizable Panels — Панели с изменяемым размером
  • Scroll Area — Область прокрутки: свои полосы, мягкие края, прилипание к низу для чатов
  • Breadcrumbs — Хлебные крошки
  • Dropdown Menu — Выпадающее меню
  • Context Menu — Контекстное меню

Назад: Segmented Control · Далее: Pagination · Весь раздел «Навигация и каркас»