Components

Toggle Group

Single or multiple pressed values with roving keyboard focus.

ToggleGroup manages a set of pressed buttons. It supports single or multiple selection, roving focus, form hidden values, item slots, and cancelable changes.

Use it for segmented controls, toolbars, and mutually exclusive or multi-select button groups. Use Checkbox Group when the choices are form-like checkboxes with labels and descriptions.

Anatomy

  • #item: Content inside each generated toggle button.

The group, hidden inputs, and buttons are generated by the component. The component owns aria-pressed, roving focus, and keyboard behavior; use ui.item for button styling.

Usage

Value: center

Examples

Single selection

Use type="single" for one pressed value. Set allow-empty="false" when one item must always stay selected.

<template>
  <ToggleGroup
    v-model="alignment"
    :allow-empty="false"
    :options="[
      { value: 'left', label: 'Left' },
      { value: 'center', label: 'Center' },
      { value: 'right', label: 'Right' },
    ]"
  />
</template>

Multiple selection

Use type="multiple" and bind to string[].

<template>
  <ToggleGroup
    v-model="formats"
    type="multiple"
    :options="[
      { value: 'bold', label: 'Bold' },
      { value: 'italic', label: 'Italic' },
      { value: 'underline', label: 'Underline' },
    ]"
  />
</template>

Card-style options

Use labels and descriptions for richer option cards.

<template>
  <ToggleGroup v-model="plan" :options="plans" :ui="{ root: 'grid gap-2' }">
    <template #item="{ label, description }">
      <span>
        <strong>{{ label }}</strong>
        <small>{{ description }}</small>
      </span>
    </template>
  </ToggleGroup>
</template>

Vertical orientation

Arrow key direction follows orientation.

<template>
  <ToggleGroup v-model="view" orientation="vertical" :options="views" />
</template>

Form values

When name is provided, selected values are submitted with the form. Multiple mode renders one hidden input per selected value.

<template>
  <ToggleGroup v-model="filters" type="multiple" name="filters" :options="options" />
</template>

API Reference

Props

PropTypeDefaultDescription
optionsToggleGroupOption[]requiredToggle items.
type"single" | "multiple""single"Selection mode.
valueKeystringObject key used as item value. Falls back to value, then label.
labelKeystring"label"Object key used as item label.
descriptionKeystring"description"Object key used as item description.
disabledKeystring"disabled"Object key used as item disabled state.
disabledbooleanfalseDisabled state for the whole group.
requiredbooleanfalsePrevents clearing the last selected value.
namestringHidden form input name. Multiple mode renders one hidden input per selected value.
orientation"horizontal" | "vertical""horizontal"Roving focus direction.
loopbooleantrueArrow navigation wraps.
rovingFocusbooleantrueEnables arrow-key roving focus.
allowEmptybooleantrueAllows single mode to clear selected item.
ariaLabelstringAccessible group label.
ariaLabelledbystringAccessible group label id.
uiToggleGroupUiClasses for structural parts.

Emits

EventPayloadDescription
value-change(value, details)Fired before model updates. details.cancel() prevents the update.

Slots

SlotPropsDescription
itemoption, value, label, description, isPressed, isDisabled, selectCustom item content.

UI Options

KeyDescription
rootRoot group.
inputHidden form inputs.
itemToggle button.
labelDefault item label.
descriptionDefault item description.

Styling Hooks

UI keyCSS classData attrs
rootakaza-toggle-groupdata-akaza-orientation, data-akaza-type, data-akaza-disabled
inputakaza-toggle-group-input
itemakaza-toggle-group-itemdata-akaza-state, data-akaza-disabled
labelakaza-toggle-group-label
descriptionakaza-toggle-group-description

Plain class applies to the root group.

Keyboard

KeyBehavior
Enter / SpaceToggle focused item.
Arrow keysMove focus by orientation.
Home / EndMove focus to first/last enabled item.