Skip to content

Toggle Group

A set of two-state buttons that can be toggled on or off.

Examples

Default

vue
<ToggleGroup type="multiple">
  <ToggleGroupItem value="bold" aria-label="Toggle bold">
    <Bold class="h-4 w-4" />
  </ToggleGroupItem>
  <ToggleGroupItem value="italic" aria-label="Toggle italic">
    <Italic class="h-4 w-4" />
  </ToggleGroupItem>
  <ToggleGroupItem value="underline" aria-label="Toggle underline">
    <Underline class="h-4 w-4" />
  </ToggleGroupItem>
</ToggleGroup>

Single Selection

vue
<ToggleGroup type="single">
  <ToggleGroupItem value="bold" aria-label="Toggle bold">
    <Bold class="h-4 w-4" />
  </ToggleGroupItem>
  <ToggleGroupItem value="italic" aria-label="Toggle italic">
    <Italic class="h-4 w-4" />
  </ToggleGroupItem>
  <ToggleGroupItem value="underline" aria-label="Toggle underline">
    <Underline class="h-4 w-4" />
  </ToggleGroupItem>
</ToggleGroup>

Props

ToggleGroup

PropTypeDefaultDescription
typesingle | multiplesingleThe type of the toggle group.
defaultValuestring | string[]-The default value of the toggle group.
modelValuestring | string[]-The controlled value of the toggle group.
disabledbooleanfalseWhether the toggle group is disabled.
rohingbooleantrueWhether the keyboard navigation should loop around.
orientationhorizontal | verticalhorizontalThe orientation of the toggle group.
dirltr | rtl-The reading direction of the toggle group.

ToggleGroupItem

PropTypeDefaultDescription
valuestring-The value of the item.
disabledbooleanfalseWhether the item is disabled.

Slots

ToggleGroup

SlotDescription
defaultThe items of the toggle group.

ToggleGroupItem

SlotDescription
defaultThe content of the item.