"use client";
import { ToggleGroup } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
options (required) | readonly PixxlItem[] | — | Options to choose from. |
defaultValue | string | null | — | Initial value when uncontrolled. |
onValueChange | (value: string) => void | — | Called with the new value (only when it changes). |
orientation | "horizontal" | "vertical" | horizontal | Layout and arrow-key axis (default horizontal): a horizontal group lays its toggles out as chips that wrap onto more rows; a vertical one stacks them at full width. |
overflow | "scroll" | "wrap" | — | Horizontal groups wider than their container: wrap onto more rows (default) or scroll sideways in one row (e.g. a filter bar). |
selectionMode | "single" | single | single (default): one pressed toggle. multiple: each toggle independent. |
value | string | null | — | Pressed option id (controlled); null for none. |
optionsrequiredreadonly PixxlItem[]
Options to choose from.
defaultValuestring | null
Initial value when uncontrolled.
onValueChange(value: string) => void
Called with the new value (only when it changes).
orientationdefault horizontal"horizontal" | "vertical"
Layout and arrow-key axis (default horizontal): a horizontal group lays its toggles out as chips that wrap onto more rows; a vertical one stacks them at full width.
overflow"scroll" | "wrap"
Horizontal groups wider than their container: wrap onto more rows (default) or scroll sideways in one row (e.g. a filter bar).
selectionModedefault single"single"
single (default): one pressed toggle. multiple: each toggle independent.
valuestring | null
Pressed option id (controlled); null for none.
Other props are passed to the root element (HTMLAttributes<HTMLDivElement>), including className, style, id and aria-* attributes.
const items = [
{ id: "candraw", label: "candraw" },
{ id: "cantext", label: "cantext" },
];
<ToggleGroup options={items} />