Components
Segmented
A pill row for a few mutually exclusive options.
Import
import { Segmented, SegmentedItem } from '@rinzai/zen';Examples
With icons
SegmentedItem holds anything (here an icon and text), and an option can be disabled.
API reference
<Segmented>
A small set of mutually exclusive options, shown as a pill row. Native radio inputs underneath, so arrow keys and forms work as for any radio group. The selection slides between options, like Pills. Fill it with SegmentedItem (any content: text, icons, a disabled option).
| Prop | Type | Default |
|---|---|---|
childrenRequiredThe SegmentedItems. | ReactNode | — |
className | string | — |
defaultValueThe first chosen option, when the control keeps its own. | string | — |
labelShown above the options, naming the group. Without it, give the group an aria-label or aria-labelledby. | ReactNode | — |
nameForm field name; defaults to a generated one. | string | — |
onValueChange | ((value: V) => void) | — |
valueThe chosen option, when you keep it. | string | — |
<SegmentedItem>
One option of a Segmented: a native radio covering whatever you put inside.
| Prop | Type | Default |
|---|---|---|
childrenRequiredWhat the option shows: text, an icon, both. | ReactNode | — |
valueRequired | string | — |
className | string | — |
disabledSkipped by the arrow keys and can't be chosen. | boolean | — |