Prepared Docs

Prepared Docs

⌘K

    Loading navigation…

User

  1. Components
  2. Toggle Group
  3. API and Development

Toggle group

API and Development

View Source
Submit Issue

ToggleGroupRoot wraps ToggleGroup.Item children as a mutually exclusive selection (type="single"). ToggleGroupItem renders a button with vertical separators and CoreText labels. Sizes: ToggleGroupSize.Small, Medium, Large (default).

ToggleGroupRoot

Name

Type

Default

Description

className

string

—

Additional CSS class name applied to the root container.

collapseUnselectedLabels

boolean

false

Collapses every unselected item down to its icon, animating the selected item's label open. Items must supply an icon and an aria-label so the collapsed items stay identifiable. Opt-in — same contract as SegmentedControl.

defaultValue

string

—

Default selected value for uncontrolled usage.

disabled

boolean

—

When true, disables all toggle items.

fullSpan

boolean

—

When true, items span the full width of the parent evenly.

onValueChange

((value: string) => void)

—

Callback fired when the selected toggle changes.

ref

Ref<HTMLDivElement>

—

Ref forwarded to the root <div> element.

size

ToggleGroupSize

ToggleGroupSize.Large

Size variant controlling height and padding.

value

string

—

Controlled selected value.

Storybook

Interactive examples and edge cases for this component are in Storybook.

Default
Full Span
Sizes
Icons
Lead Icon And Text
Collapse Unselected Labels
Collapse Unselected Labels Small
Vs Segmented Control

ToggleGroupRoot props

PropDefaultDescription
collapseUnselectedLabelsfalseAnimates unselected items down to their icons. Every collapsible item must provide icon and aria-label.

ToggleGroupItem

Name

Type

Default

Description

value

string

required

Stable id for selection.

disabled

boolean

false

Disables one option.

children

ReactNode

required

Visible label.

icon

SVGAsset

—

Leading icon; required for items that collapse under collapseUnselectedLabels.

aria-label

string

—

Accessible name; required when the label collapses to an icon.

Default

Controlled

Sizes

Icons

Collapse unselected labels

Lead icon and text

ToggleGroup vs SegmentedControl

Previous

Toggle Group / Usage

Next

Toggle Group / Accessibility

On this page

ToggleGroupRoot
Storybook
ToggleGroupRoot props
ToggleGroupItem
Default
Controlled
Sizes
Icons
Collapse unselected labels
Lead icon and text
ToggleGroup vs SegmentedControl