Skip to content

SegmentedControl

SegmentedControl

<SegmentedControl defaultSelectedKeys={['day']} aria-label="Range">
<Segment id="day">Day</Segment>
<Segment id="week">Week</Segment>
<Segment id="month">Month</Segment>
</SegmentedControl>

Install: @helixui/core

import { SegmentedControl, Segment } from '@helixui/core'

status: stable · since: 0.1.0

Tags: toggle-group, tabs, choice

Anatomy

[ Day ][ Week ][ Month ] ← exclusive choice (one filled)

Layout

  • displayinline-flex
  • widthcontent
  • heightcontent
  • intrinsicSizepill row, ~28-36px tall
  • stackablefalse
  • fullBleedfalse

Visual

A pill-shaped row of equal-width segments with a sliding active background. Active segment uses elevated surface; inactive use subtle background.

Props

NameTypeDefaultDescription
size'sm' | 'md'mdControl height.
selectionMode'single' | 'multiple'singleSelection model.
disallowEmptySelectionbooleantruePrevent unselecting the last item in single mode.
selectedKeysSet<string>Controlled selection.
defaultSelectedKeysIterable<string>Uncontrolled initial selection.
onSelectionChange(keys: Set<string>) => voidSelection change handler.

Slots

  • children — Segment components

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

Role: radiogroup

Keyboard

KeyAction
ArrowLeftMove focus left.
ArrowRightMove focus right.
SpaceSelects focused segment.

Notes

  • For 5+ options, prefer Tabs or a Select.

Composes with

ComponentRelationNote
TabsalternativeTabs for in-page section switching; SegmentedControl for compact view modes.

Prompt examples

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

view mode picker

“segmented control Day / Week / Month”

<SegmentedControl value={mode} onChange={setMode}>
<Segment value="day">Day</Segment>
<Segment value="week">Week</Segment>
<Segment value="month">Month</Segment>
</SegmentedControl>