Skip to content
Playground

Toggle Group

A coordinated single- or multiple-selection group of toggles with shared styling.

A coordinated single- or multiple-selection group of toggles. Each ToggleGroup.Item is a Toggle and inherits the same semantic surfaces, pressed colors, icon padding, and sizes from the group root unless overridden on the item.

Backed by Base UI Toggle Group for upstream behavior and configuration. Zenos owns the public API, styling, and composition shown on this page.

TSX
import { ToggleGroup } from "@zentara-co/zenos-ui";

Use ToggleGroup.Item for each option and give the group an accessible name with aria-label or aria-labelledby. Text and icon children follow the same layout rules as standalone Toggle controls (automatic padding for text-only, leading icon, trailing icon, and icon-only layouts).

TSX
import { ToggleGroup } from "@zentara-co/zenos-ui"; <ToggleGroup defaultValue={["list"]} variant="subtle" aria-label="View">  <ToggleGroup.Item value="list">List</ToggleGroup.Item>  <ToggleGroup.Item value="grid">Grid</ToggleGroup.Item></ToggleGroup>;

Set variant on the group root so every item shares one surface treatment. Defaults match Toggle: variant="subtle" and size="md".

VariantUse
subtleDefault filled neutral surface (recommended for most groups).
subtle-outlineFilled neutral surface with a border; the previous outline appearance.
outlineTransparent surface; selected border, translucent fill, and semibold label when pressed.
defaultTransparent until hover; lightweight toolbar groups.

Single selection is the default and stores its selected item in a string array. Add multiple when choices may be combined. Use controlled value and onValueChange when the application owns selection.

Active formatting: bold, italic

Pressed outline items use a selected border, translucent selected cover, selected text, and a semibold label in both themes. Other variants retain the accent red subtlest pressed fill. Disabled items use muted text; a disabled pressed item keeps a faint red surface and accent red label so the prior selection stays visible but not editable.

To preserve the previous filled, bordered appearance, change the group root to variant="subtle-outline". Individual items can override the inherited variant.

Vertical groups stack items and change roving-focus navigation to Up and Down Arrow.

Pass className to ToggleGroup to customize its layout, gap, container surface, and border. Style every item from the root with the [data-slot=toggle-group-item] selector, or pass className to an individual ToggleGroup.Item when only one option needs a different treatment.

Items expose data-pressed for the selected state. Prefer semantic tokens for custom surfaces and foregrounds, and keep visible hover and focus feedback intact. Selection behavior, roving focus, orientation, and inherited size remain unchanged.

PropTypeDefaultDescription
variant 'default' | 'outline' | 'subtle' | 'subtle-outline' subtle Surface treatment inherited by items.
size 'sm' | 'md' | 'lg' md Control height inherited by items.
multiple boolean false Allows more than one pressed item.
orientation 'horizontal' | 'vertical' horizontal Layout and arrow-key navigation direction.
value / defaultValue string[] — Controlled or initial selected item values.
onValueChange (value: string[], eventDetails) => void — Runs when selection changes.

Sizes

smmdlg
ToggleGroup.Root
ToggleGroup.Item

API

PropTypeDefaultDescription
value string[] — Controlled selected values.
defaultValue string[] — Initial uncontrolled values.
onValueChange (value: string[], eventDetails) => void — Runs when selection changes.
multiple boolean false Allows more than one pressed item.
variant default | outline | subtle | subtle-outline subtle Surface treatment inherited by items (same semantics as Toggle).
size sm | md | lg md Control height inherited by items.
orientation horizontal | vertical horizontal Layout and roving-focus direction.
disabled boolean false Disables every item in the group.
native props React.Base UI ToggleGroup props — Forwards native attributes, events, aria-*, data-*, className, style, and ref.

Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props, including className, style, aria-*, and data-*.

Give every group a name with aria-label or aria-labelledby, and label icon-only items individually. Arrow keys move focus according to orientation while Space or Enter changes the focused item. Disabled items are skipped. Use single selection for mutually exclusive views and multiple selection only when simultaneous pressed states make sense.

See Toggle for standalone two-state controls and per-item pressed / onPressedChange when selection is not shared.