Skip to content

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

[ Day ][ Week ][ Month ] ← exclusive choice (one filled)
  • display — inline-flex
  • width — content
  • height — content
  • intrinsicSize — pill row, ~28-36px tall
  • stackable — false
  • fullBleed — false

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

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

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.
Component Relation Note
Tabs alternative Tabs for in-page section switching; SegmentedControl for compact view modes.

These are the AI prompt → JSX mappings used by the helix-ui prompt DSL and integrations like Cursor / Claude Code.

“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>