Segmented Control
A row of options with a pill that slides and resizes to the one you pick. Arrow keys move the choice.
pixikit.com/docs/components/segmented-control
Customize
Orientation
Height45px
Padding4px
Item padding x14px
Gap0px
Radius14px
Pill radius10px
Font size12.0px
Font weight400
Duration0.30s
Easing
Track color
Border color
Border width1.0px
Pill color
Text color
Active text color
Full width
Disabled
Props
27| Name | Type | Default | Description |
|---|---|---|---|
options | string[] | DEFAULT_OPTIONS | The choices, in order. |
value | string | None | The chosen option, when you hold the state. |
defaultValue | string | None | The option chosen at first, when the control holds the state. |
onValueChange | (value: string) => void | None | Called with the option the user picks. |
disabledOptions | string[] | [] | Options that cannot be picked. |
orientation | "row" | "column" | "row" | `row` lays the options side by side, `column` stacks them. |
height | number | 45 | Control height in a row, and the height of each option in a column, in px. |
padding | number | 4 | Space between the track edge and the options, in px. |
itemPaddingX | number | 14 | Space left and right of each label, in px. |
gap | number | 0 | Space between options, in px. |
radius | number | 14 | Corner radius of the track, in px. |
pillRadius | number | 10 | Corner radius of the sliding pill, in px. |
fontSize | number | 12 | Label size, in px. |
fontWeight | number | 400 | Label weight. |
duration | number | 0.3 | Seconds the pill takes to slide and resize. |
easing | "ease" | "ease-out" | "ease-in-out" | "spring" | "linear" | "ease" | How the pill moves. |
trackColor | string | "transparent" | Track fill. |
borderColor | string | "var(--border)" | Track border colour. |
borderWidth | number | 1 | Track border width, in px. |
pillColor | string | "var(--muted)" | Fill of the sliding pill. |
textColor | string | "var(--muted-foreground)" | Label colour of the options that are not chosen. |
activeTextColor | string | "var(--foreground)" | Label colour of the chosen option. |
fullWidth | boolean | false | Stretches the control to its container and shares the width between the options. |
disabled | boolean | false | Turns the whole control off. |
ariaLabel | string | "Options" | Name for the group, read by screen readers. |
className | string | "" | |
style | CSSProperties | None |