structyl

Toggle Group API

View component

The full prop reference for the Toggle Group component. A set of two-state buttons that can be single or multiple select.

Import

tsx
import { ToggleGroup } from '@structyl/styled';

Props

ToggleGroup.Root

Container for toggle group items with controlled/uncontrolled state support. Supports single or multiple selection modes with roving focus navigation.

PropTypeDefault
type#'single' | 'multiple'

Determines if one or multiple toggles can be active at a time

value#string | string[] (based on type)

Controlled value(s) of active toggle(s). string for type='single', string[] for type='multiple'

defaultValue#string | string[] (based on type)

Initial value(s) when uncontrolled. string for type='single', string[] for type='multiple'

onValueChange#(value: string | string[]) => void

Callback fired when active toggle(s) change. Receives string for type='single', string[] for type='multiple'

disabled#boolean

Whether all toggle items are disabled

false
orientation#'horizontal' | 'vertical'

Layout orientation for roving focus navigation

dir#'ltr' | 'rtl'

Text direction for roving focus

rovingFocus#boolean

Enable roving tab focus behavior (arrow keys to navigate, Tab to enter group)

true
loop#boolean

Whether focus wraps at the end/start during roving focus navigation

true
asChild#boolean

Render as child element (from Radix Slot pattern)

className#string

CSS class name (styled layer adds flex items-center justify-center gap-1 as base)

variant#'default' | 'outline'

Visual variant for toggle items (styled layer only)

'default'
size#'default' | 'sm' | 'lg'

Size variant for toggle items: 'sm'=h-9 px-2.5, 'default'=h-10 px-3, 'lg'=h-11 px-5 (styled layer only)

'default'
color#'default' | 'primary' | 'secondary' | 'error' | 'warning' | 'info' | 'success'

Color variant for active state of toggle items (styled layer only)

'default'

ToggleGroup.Item

Individual toggle within a toggle group. Acts as a button that can be pressed/unpressed. Inherits variant/size/color from parent Root.

PropTypeDefault
value#string

Unique identifier for this toggle item within the group

disabled#boolean

Whether this specific toggle is disabled (combines with Root.disabled)

asChild#boolean

Render as child element (from Radix Slot pattern)

className#string

CSS class name (styled layer applies toggleVariants with inherited variant/size/color)

variant#'default' | 'outline'

Visual variant override (styled layer only). Falls back to Root variant if not provided

size#'default' | 'sm' | 'lg'

Size variant override (styled layer only). Falls back to Root size if not provided

color#'default' | 'primary' | 'secondary' | 'error' | 'warning' | 'info' | 'success'

Color variant override (styled layer only). Falls back to Root color if not provided

Source code

If you didn't find what you need here, read the component implementation .

structyl — Accessible React Component Library