Toggle Group

A group of toggle buttons where only one can be active at a time.

Import

Usage

Colors

Variants

Select a color:

Default

Bordered

Light

Ghost

Ethereal

Sizes

Radius

Shadowed

With Icons

Full Width

Buy/Sell Toggle

Disabled

Custom Implementation

Data Attributes

  • -
    data-slot="toggle-group"Toggle group container identifier
  • -
    data-state="on" | "off"Indicates whether an item is selected or not

Accessibility

Keyboard Support

  • -
    TabMoves focus to the next focusable element
  • -
    SpaceActivates the toggle item
  • -
    EnterActivates the toggle item

ARIA Attributes

  • -
    role="radiogroup"Applied to the toggle group container
  • -
    role="radio"Applied to each toggle item
  • -
    aria-checkedIndicates the selected state of each item

ToggleGroup Props

AttributeTypeDefaultDescription
type'single''single'The type of toggle group (currently only single selection supported).
valuestring-Controlled value of the selected item.
defaultValuestring-Default value for uncontrolled component.
onValueChange(value: string) => void-Callback when the selected value changes.
variant'default' | 'bordered' | 'light' | 'ghost' | 'ethereal''bordered'Visual style variant of the toggle group.
size'sm' | 'md' | 'lg'-Size of the toggle items.
color'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'lavender'-Color scheme of the toggle group.
radius'none' | 'sm' | 'md' | 'lg' | 'full''md'Border radius of the toggle group.
shadowedbooleanfalseWhether to add Material Design elevation shadows to the toggle group.
fullWidthbooleanfalseWhether items should span the full width of the container.
disabledbooleanfalseWhether all items in the group are disabled.

ToggleGroupItem Props

AttributeTypeDefaultDescription
valuestring-The unique value for this toggle item (required).
variant'default' | 'bordered' | 'light' | 'ghost' | 'ethereal'Inherited from ToggleGroupOverride the variant for this specific item.
size'sm' | 'md' | 'lg'Inherited from ToggleGroupOverride the size for this specific item.
color'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'lavender'Inherited from ToggleGroupOverride the color for this specific item.
radius'none' | 'sm' | 'md' | 'lg' | 'full'Inherited from ToggleGroupOverride the border radius for this specific item.
shadowedbooleanInherited from ToggleGroupOverride the shadow for this specific item.
startContentReactNode-Content to display before the item text (e.g., icons).
endContentReactNode-Content to display after the item text (e.g., icons).
disabledbooleanfalseWhether this specific item is disabled.
iconOnlybooleanfalseWhether this item should be square-shaped for icon-only usage.
disableRipplebooleanfalseWhether to disable the ripple effect for this item.