Skip to content

Forms

IToggleGroup

A row of toggles sharing one model — a view switcher, a date range, a formatting toolbar. The group is one Tab stop, with the arrow keys moving between items.

Single or multiple

single is the default and behaves like a segmented control — one item on at a time, with the model holding that item's value. multiple lets any number be on, and the model becomes an array.

Active: Bold

Items

A bare string becomes both the label and the value. Pass objects when the two differ, or when an item needs an icon, an ariaLabel or disabling.

ts
const items = [
  'List', //                                    label and value both "List"
  { label: 'Board', value: 'board' }, //         value differs from the label
  { label: 'Calendar', icon: CalendarIcon }, //  icon beside the label
  { label: 'Timeline', disabled: true }, //      present but not selectable
]

Variants

variant decides how the items are spaced. joined, the default, squares them where they meet and collapses their adjacent borders, as IButtonGroup does. plain leaves them as free-standing buttons with a gap.

Either way an item is the same button IToggle renders, so a group and a lone toggle sit together.

Icon-only

icon-only hides the labels and squares the items. Each label becomes its item's accessible name; pass ariaLabel on an item when the label is too terse to stand alone.

Sizes

The same five sizes as IToggle and IButton.

Full width

block stretches the group and splits the width evenly between its items.

Vertical

Props

PropTypeDefaultDescription
items(string | ToggleGroupItemOption)[][]
type'single' | 'multiple''single'Decides whether the model is a value or an array
modelValuestring | string[]
variant'joined' | 'plain''joined'Whether the items touch or stand apart
size'xs' | 'sm' | 'md' | 'lg' | 'xl''md'
orientation'horizontal' | 'vertical''horizontal'Also decides which arrow keys move focus
iconOnlybooleanfalseHide labels, square the items, keep the names
blockbooleanfalseStretch to fill, splitting the width
disabledbooleanfalseDisables the whole group
loopbooleanfalseWrap from the last item back to the first
unstyledbooleanSkip built-in classes
ui{ root?, item? }Per-slot class overrides

ToggleGroupItemOption

FieldTypeDescription
labelstring
valuestringDefaults to the label
iconIconLike
disabledboolean
ariaLabelstringNames the item when iconOnly hides its label

Events

EventPayload
update:modelValuestring | string[]

Slots

SlotPropsDescription
item{ item }Replaces an item's contents

Accessibility

The group is one Tab stop; arrow keys move between items from there, along the axis orientation sets. Set loop to wrap around at the ends. With icon-only, each item's hidden label becomes its aria-label, so the group never reaches a screen reader as a row of unnamed buttons.