ToggleGroup

Actions

A set of joined toggles: <ToggleGroup.Root> (type="single" or "multiple", bind:value, variant, size) holds ToggleGroup.Items (value). Arrow keys move between items; Space or Enter presses one. Name the group with aria-label.

import { ToggleGroup } from '@limerdev/zest';
ToggleGroup for AI tools (llms.txt)
Use for
Picking one or several of a few view options shown at once: alignment, a chart's period (day, week, month), which columns to show.
Don't
A choice in a form: use RadioGroup or Checkboxes. Switching views of a page's content: use Tabs.

Examples

Basic

type="single" picks one period; type="multiple" shows several columns.

Per week, showing hours

Props

Every part also takes class (merged over its defaults), ref (bindable: the element), children, and child (a snippet that renders your own element, with props to spread on it).

ToggleGroup.Root

Prop Type Default Description
disabled boolean false Whether the toggle group is disabled or not.
loop boolean true Whether to loop through the items when reaching the end when using the keyboard.
onValueChange OnChangeFn<string> | OnChangeFn<string[]> –
orientation "horizontal" | "vertical" 'horizontal' The orientation of the toggle group. Used to handle keyboard navigation between items.
rovingFocus boolean – Whether to enable roving focus or not. When enabled, users navigate between the items using the arrow keys. When disabled, users navigate between the items using the tab key.
size "default" | "sm" | "lg" 'default' The height and padding, from the theme's field size.
type required "multiple" | "single" –
value bindable string | string[] –
variant "outline" | "default" 'default' default is plain until pressed; outline has a border.

ToggleGroup.Item

Prop Type Default Description
disabled null | false | true false Whether the toggle item is disabled or not.
value required string – The value of the toggle item.