SegmentedControl

View source on GitHub

SegmentedControl may be used to group multiple selections. The controls display the current state and related state.

Create layout to convey clear sense of information hierarchy. When a control is engaged, information below the control should also be updated.

also known as Toggle Group
Web:

iOS:

Android:

Props

Component props
Name
Type
Default
items
Required
$ReadOnlyArray<React.Node>
-

Items for selection. Though typically strings, React.Node is accepted to allow for Icons or other custom UI.

onChange
Required
({| event: SyntheticMouseEvent<HTMLButtonElement>, activeIndex: number |}) => void
-

Callback triggered when the user selects an item.

selectedItemIndex
Required
number
-

Index of element in items that is currently selected.

responsive
boolean
-

By default, items have equal widths. If this prop is true, the width of an item is based on its content. See the responsive example for more details.

Usage guidelines

When to use
  • To switch between views within a small area of content, such as a Popover.
When not to use
  • To switch between views that represent the main content of a surface. Use Tabs instead.
  • To act as a radio control within a form. Use RadioGroup instead.

Accessibility

Variants

Example

Segmented Control is a naive component, meaning you need to wire any additional behavior when the user clicks on an item. If you'd like the tabs to control hiding or showing content, that state should live in a parent component.

Example: Responsive

Segmented Control can have responsive widths where the width of an item is based on its content.

Component quality checklist

Component quality checklist
Quality item
Status
Status description
Figma Library
Partially ready
Component is live in Figma, however may not be available for all platforms.
Responsive Web
Ready
Component is available in code for web and mobile web.
iOS
Component is not currently available in code for iOS.
Android
Component is not currently available in code for Android.