SegmentedControl
SegmentedControl
Section titled “SegmentedControl”Category: Forms & inputs
<SegmentedControl defaultSelectedKeys={['day']} aria-label="Range"> <Segment id="day">Day</Segment> <Segment id="week">Week</Segment> <Segment id="month">Month</Segment></SegmentedControl>Install: @helix-ui/core
import { SegmentedControl, Segment } from '@helix-ui/core';status: stable · since: 0.1.0
Tags: toggle-group, tabs, choice
Anatomy
Section titled “Anatomy”[ Day ][ Week ][ Month ] ← exclusive choice (one filled)Layout
Section titled “Layout”- display —
inline-flex - width —
content - height —
content - intrinsicSize —
pill row, ~28-36px tall - stackable —
false - fullBleed —
false
Visual
Section titled “Visual”A pill-shaped row of equal-width segments with a sliding active background. Active segment uses elevated surface; inactive use subtle background.
| Name | Type | Default | Description |
|---|---|---|---|
size |
'sm' | 'md' |
md |
Control height. |
selectionMode |
'single' | 'multiple' |
single |
Selection model. |
disallowEmptySelection |
boolean |
true |
Prevent unselecting the last item in single mode. |
selectedKeys |
Set<string> |
— | Controlled selection. |
defaultSelectedKeys |
Iterable<string> |
— | Uncontrolled initial selection. |
onSelectionChange |
(keys: Set<string>) => void |
— | Selection change handler. |
- children — Segment components
Tokens used
Section titled “Tokens used”color.bg.action.neutral.default, color.bg.surface.default, color.text.primary, color.text.secondary, color.border.focus, radius.md, space.3, font.family.sans, font.size.xs, font.size.sm, font.weight.medium, shadow.sm
Accessibility
Section titled “Accessibility”Role: radiogroup
Keyboard
| Key | Action |
|---|---|
ArrowLeft |
Move focus left. |
ArrowRight |
Move focus right. |
Space |
Selects focused segment. |
Notes
- For 5+ options, prefer Tabs or a Select.
Composes with
Section titled “Composes with”| Component | Relation | Note |
|---|---|---|
Tabs |
alternative |
Tabs for in-page section switching; SegmentedControl for compact view modes. |
Prompt examples
Section titled “Prompt examples”These are the AI prompt → JSX mappings used by the helix-ui prompt DSL and integrations like Cursor / Claude Code.
view mode picker
Section titled “view mode picker”“segmented control Day / Week / Month”
<SegmentedControl aria-label="Range" selectedKeys={mode} onSelectionChange={setMode}> <Segment id="day">Day</Segment> <Segment id="week">Week</Segment> <Segment id="month">Month</Segment></SegmentedControl>