SegmentedControl
Single- or multi-select segmented control for view and filter switches.
Design intent
Filters such as All / Investors / Advisors are often built with Tabs, which wrongly promises tabpanels. SegmentedControl provides radio semantics for single choice and pressed buttons for multi-select, with arrow-key navigation.
npx @slipstream-ui/cli@latest add segmented-controlAudience (single select)
Selected: teams
Report type (multi select)
Selected: integration
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| options | SegmentedOption[] | required | Segments to render: value, label, optional icon, hint, disabled, and href for link rendering. |
| value | string | string[] | — | Controlled selection. Use string[] when multiple. |
| defaultValue | string | string[] | — | Initial selection when uncontrolled. |
| onValueChange | (value: string | string[]) => void | — | Fires with the next selection. |
| multiple | boolean | false | Allow more than one segment to be active. |
| size | 'sm' | 'md' | 'lg' | 'md' | Control density. |
| fullWidth | boolean | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | false | Stretch segments to fill the container width; a breakpoint string fills only below that breakpoint. |
| linkComponent | React.ElementType | — | Custom link element for routers; used by options that set href. |
| linkHrefProp | 'href' | 'to' | 'href' | Prop used to pass the destination to linkComponent. |
Anti-patterns
validate_usage is the MCP tool that rejects these mistakes: the same list agents see over MCP and in the canonical markdown.
Don't use it for tab panels
If each segment reveals its own panel, use Tabs so aria-controls and tabpanel semantics are correct.
tsx// Avoid<SegmentedControl options={panels} />// Prefer<Tabs defaultValue="overview">...</Tabs>Don't omit the accessible name
A radiogroup without a name is ambiguous. Pass aria-label or aria-labelledby.
tsx<SegmentedControl aria-label="Audience" options={options} />
Accessibility
- Single-select uses role=radiogroup/radio with aria-checked and arrow-key navigation.
- Multiple uses role=group with aria-pressed on each segment.
- Options with href render links; the active segment is a non-link aria-current="page" marker.
- Pass aria-label or aria-labelledby; the default name is generic.
Content guidelines
Segment labels
- One or two words
- Parallel grammar
- No punctuation
Good examples
- Investors
- Advisors
- Owners
Bad examples
- Show me investors
- Advisors!
Composition
Compose with FilterChips: Pair a multi-select control with FilterChips to show and remove active filters
<><SegmentedControl multiple /><FilterChips filters={chips} /></>
Compose with Tabs: Use Tabs when each option owns a tabpanel; use SegmentedControl for filters
<Tabs defaultValue="overview">...</Tabs>
Related components: Tabs, FilterChips, SelectMenu
Dependencies
What the registry installs alongside this component. Package imports already include these.
npm packages
- class-variance-authority
- clsx
- tailwind-merge
Browser support
| Browser | Tested versions |
|---|---|
| Chrome | 111+ (Mar 2023) |
| Edge | 111+ (Mar 2023) |
| Firefox | 121+ (Dec 2023) |
| Safari | 17.2+: macOS & iOS (Dec 2023) |
Slipstream components rely only on CSS custom properties, Flexbox/Grid, and ARIA, the everyday baseline of the last two years of evergreen releases. Anything newer is progressive enhancement: unsupported browsers keep full functionality with static behavior instead of animations.