Skip to main content

Examples

Brand

Disabled

Controlled

All Variants

Collapsible

Props

SegmentedControl

A compact selector for choosing between two or three mutually exclusive options where the choice affects the content immediately below it. Use instead of tabs when the options are more like settings or filters than navigation, such as toggling a list/grid view or a monthly/annual price. Rendered as a radiogroup with roving-tabindex keyboard navigation. Supports both controlled and uncontrolled usage. With collapsible, the icon-bearing plain/brand appearances shrink to a single cycling icon toggle when space is tight (rendered as a group containing one button).
SegmentedControlOption[]
required
The selectable segments. Designed for two or three mutually exclusive options.
"brand" | "pill" | "plain"
default:"pill"
Visual style of the control.
ReactNode
Single glyph for the collapsed toggle, replacing the selected option’s icon. Use it when the collapsed control should read as one switch affordance rather than as a preview of the current selection — the collapsed navigation rail shows a repeat glyph this way. The button still announces the selected option as its accessible name, so the current state stays available to assistive tech. Only meaningful alongside collapsible.
boolean
default:"false"
When true, the control automatically collapses to a single icon-only toggle whenever its container is too narrow to show every segment side by side, and expands again when the space returns. Collapsed, it shows collapsedIcon when given and otherwise the currently-selected option’s icon; clicking it (or pressing Enter/Space) advances to the next option, wrapping around from the last back to the first.Only supported for the icon-bearing "plain" and "brand" appearances, and every option must define an icon unless collapsedIcon is given (there is nothing to show otherwise). Ignored, with a dev-time warning, when those conditions are not met.
string
Initially selected value (uncontrolled). Defaults to the first option.
boolean
default:"false"
Whether the control is disabled.
((value: string) => void)
Callback fired when the selected value changes.
"32" | "40" | "48"
default:"32"
Height of the control in pixels.
string
Currently selected value (controlled).
"fill" | "hug"
default:"hug"
Segment layout.

Exported types

Also exported from @fanvue/ui: SegmentedControlAppearance, SegmentedControlOption, SegmentedControlProps, SegmentedControlSize, SegmentedControlVariant.
Setup: Installation · Theming