Skip to content
TrademarkTrademark
Docs
Components

SegmentedControl

Updated: May 9, 2025
View on GitHub

Use this component for toggle-style selection between discrete options. It supports keyboard interaction, styling, and controlled or uncontrolled usage.

External state

Use selected to manage the selected state from the parent.

Internal state

Use defaultValue to define an initial active button in uncontrolled mode. Don't use it along with the value prop.

Radio group

A tab strip is the default, for switching views. For one choice among settings, semantics="radio" makes the segments a radiogroup of radios: the arrow keys move and choose, as native radios do. Name it with aria-label or aria-labelledby.

Compact

Use compact to create a compact variant.

Controlled state

Control the selected value externally with the value prop.

Fill width

Distribute the button widths evenly across the container.

Narrow spaces

Options that do not fit scroll behind a Next button. In a narrow sidebar that clips the last one; scroll={false} keeps them in a plain row that shares the width equally and truncates a label that does not fit. An option's description adds a second, dimmer line under its label. Without onChange the control keeps its own selection, starting from defaultValue.

API reference

Type
Default
buttonsrequired
ButtonOption[]—
onChange
(value: string, event?: React.MouseEvent<HTMLButtonElement>) => void—
defaultValue
string—
fillWidth
booleantrue
value
string—
compact
Tighter padding, for dense toolbars.
booleanfalse
semantics
`tabs` (a tab strip) or `radio` (one choice from a set of settings, a radio group).
tabsradio
tabs
scroll
`false` shares the width between the options and truncates labels, instead of scrolling them.
booleantrue
className
string—
style
React.CSSProperties—
…and every FlexProps propinherited—
…and every ScrollerProps propinherited—
Edit this page on GitHub