Toggle Group

A set of toggle buttons: pick one, like text alignment, or turn on several, like bold and italic.
Stable
Web
iOS
Android
@advui/core
Source

Single choice

Installation

pnpm
pnpm add @advui/core
npm
npm install @advui/core

Usage

import { ToggleGroup } from '@advui/core'

<ToggleGroup type="single" defaultValue="left" aria-label="Text alignment">
  <ToggleGroup.Item value="left" aria-label="Align left" icon={<AlignLeftIcon />} />
  <ToggleGroup.Item value="center" aria-label="Align center" icon={<AlignCenterIcon />} />
  <ToggleGroup.Item value="right" aria-label="Align right" icon={<AlignRightIcon />} />
</ToggleGroup>

Examples

Multiple and with labels

Formatting buttons that combine, and a view switcher with text.
Style: bold

API reference

ToggleGroup

PropTypeDefaultDescription
type required'single' | 'multiple'—`single`: one choice at a time (it stays chosen when pressed again). `multiple`: any number on.
valuestring | string[]—The chosen item (`single`) or items (`multiple`), when you control them.
defaultValuestring | string[]—Starting `value` when uncontrolled.
onValueChange(value) => void—Called with a string (single) or an array (multiple).
variant'default' | 'outline''default'Applies to every item.
size'sm' | 'md' | 'lg''md'Applies to every item.
orientation'horizontal' | 'vertical''horizontal'Layout direction.
disabledbooleanfalseDisables every item.
aria-labelstring—Names the group for screen readers, e.g. “Text alignment”.

ToggleGroup.Item

PropTypeDefaultDescription
value requiredstring—Unique value.
iconReactNode—Icon before the label.
disabledbooleanfalseNot selectable.
aria-labelstring—Required for icon-only items.

Accessibility

  • type="single" is a radiogroup of radio items with aria-checked, so screen readers say “1 of 3, selected”.
  • type="multiple" is a group of toggle buttons with aria-pressed.
  • Name the group with aria-label and every icon-only item with its own aria-label.
  • On iOS and Android items are radio buttons or toggle buttons with a checked state, and touch targets are at least 44pt.
Keyboard interactions
KeyAction
TabMoves focus into the group (to the chosen item) and out again.
Arrow keysMove between items; in a single-choice group they also choose.
Home / EndFirst / last item.
Space / EnterTurns the focused item on or off.

Responsive behavior

Items wrap to the next line when there is not enough room.

Platform notes

Web
One Tab stop for the whole group (roving tabindex).
iOS
VoiceOver reads each item as a radio button or toggle button.
Android
TalkBack reads each item as a radio button or toggle button. With androidRipple (on in material()), presses show the native ripple.
Since v0.2.0Last updated Nov 2, 2026Edit this page on GitHub