Client component

Segmented Control

A single-choice control styled as connected segments, the classic "view switcher". Under the styling it is a group of native radios (visually hidden), so arrow-key movement, form participation and radio semantics come from the platform, not from JavaScript re-implementations.

Import#

import { SegmentedControl } from "astralis-ui";

Sizes#

Full width#

fullWidth stretches the track and shares the width equally between segments:

Segmented Control vs Tabs vs CheckableTag#

  • SegmentedControl: one value from a few, radio semantics, no panels.
  • Tabs: switches visible content panels.
  • CheckableTag: chip-shaped multi/single select for filtering, wraps freely.

Props#

PropTypeDefaultDescription
value / defaultValue / onChangestring / string / (value: string) => voidNoneControlled / uncontrolled selection.
size"sm" | "md" | "lg""md"Segment height and text size.
fullWidthbooleanfalseStretches to the container, sharing the width equally between segments.
disabledbooleanfalseDisables every segment.
namestringgeneratedName of the segment radios, so the choice submits with a native form.

SegmentedControl.Item#

PropTypeDefaultDescription
valuestringNoneThe value this segment represents. Required.
childrenReactNodeNoneSegment label.
disabledbooleanfalseDisables just this segment.

Keyboard#

The segments are native radios, so the keys are the browser's own:

KeyAction
TabInto the control: one tab stop, on the selected segment
← ↑ / → ↓Select the previous / next segment
SpaceSelect the focused segment, when none is selected yet