"use client";
import { SegmentedControl } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
items (required) | readonly ChoiceItem[] | — | Items to render. |
defaultValue | string | null | none | Selected id when uncontrolled (default: none). |
fullWidth | boolean | — | Fill the container's width with equal options; labels that still do not fit end in an ellipsis (e.g. a settings dialog on a phone). |
onValueChange | (value: string) => void | — | Called with the new value (only when it changes). |
overflow | "scroll" | "wrap" | — | When the options are wider than the container: wrap onto more rows, or scroll sideways in one row. Unset: one row at its natural width. |
size | "sm" | "md" | md | Control height (default md). |
value | string | null | — | Selected item id (controlled); null for none. |
itemsrequiredreadonly ChoiceItem[]
Items to render.
defaultValuedefault nonestring | null
Selected id when uncontrolled (default: none).
fullWidthboolean
Fill the container's width with equal options; labels that still do not fit end in an ellipsis (e.g. a settings dialog on a phone).
onValueChange(value: string) => void
Called with the new value (only when it changes).
overflow"scroll" | "wrap"
When the options are wider than the container: wrap onto more rows, or scroll sideways in one row. Unset: one row at its natural width.
sizedefault md"sm" | "md"
Control height (default md).
valuestring | null
Selected item 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" },
];
<SegmentedControl items={items} />