Segmented Control

Segmented control for switching between a few views of the same content.

import { SegmentedControl } from "@plexui/react-native"

Examples

Overview

System control

Platforms

iOS 26Android
Native componentSegmented controlA segmented capsule, in place of Material's connected button group
LookA capsule whose thumb slides to the selectionA white capsule, the selected segment on a sliding pill of the accent at 12%
System control (system)SwiftUI's segmented Picker (@expo/ui)The kit's capsule

Not Material's Tabs, which sit under a top app bar with an underline.

API

SegmentedControl

PropTypeDefaultDescription
valuestring—The value of the selected segment (required, controlled)
onChange(nextValue: string) => void—Called with the value of the segment a person selects
onClick() => void—Called on any press of the control, even when the value stays
aria-labelstring—Name of the control for assistive technology (required)
size"3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl""md"iOS: sm and smaller the small 32pt control, md and larger the large 48pt one. Android: 32dp at sm and smaller, 36 at md, 40 at lg, 44 above
mobileMaterial"glass" | "flat""glass" at md and larger, "flat" at sm and smalleriOS: flat gives the large control the plain look (49pt), glass gives the small one glass. In a Toolbar the control is the large glass one
showBadgesbooleanfalseDraws each tab's badge, a count in a capsule after its label; the segments then take their own widths. Off, the count is only read with the segment's name
badgeColor"label" | "accent""label"The drawn counts' color: label takes the label's on the selected segment and the secondary one on the others, so a count changes with the selection; accent draws one accent capsule with white digits on every segment, as TabBar's badgeColor="accent", in a color role of its own (--segmented-control-badge-background, --segmented-control-badge-color; the accent by default), so recoloring the selection leaves the counts in the accent
positionnumber—Where the thumb stands while something else moves the selection, a fractional index (a Pager's onPageScroll): the thumb follows it, taking each width between. Unset or at the selected index, it slides to the selection
systembooleanthe theme's --mobile-system-controls (on), else falseiOS with @expo/ui: SwiftUI's segmented Picker in place of the kit's control, its lens and glass exactly the iPhone's, its words in the system's face; the kit's where it cannot follow (Android, the web, no @expo/ui, a disabled segment, a symbol alone, a segment's aria-label or badge, showBadges, position, onClick)
--mobile-system-controlstoken: on | off—on: every control that offers system draws the system's (SegmentedControl)
--segmented-control-styletoken: segmented | tabs—tabs: the names across the row on a hairline, the shown one with a line under it that follows position (Material's primary tabs on Android, where a control following a pager in a Toolbar.Row is tabs by default). Tokens --segmented-tabs-height, -color, -color-on, -indicator-color, -indicator-height, -divider-color
mobileSegmentWidth"equal" | "content""equal"Every segment the widest one's width, or each its own label's
blockbooleanfalseFills the row, the segments sharing its width
disabledbooleanfalseDisables every segment
pillboolean—Kept for @plexui/ui's API: a phone's segmented control is always a capsule
childrenReactNode—SegmentedControl.Tab elements
styleStyleProp<ViewStyle>—Style of the control's outer box
testIDstring—Test id

SegmentedControl.Tab

PropTypeDefaultDescription
valuestring—The segment's value (required)
childrenReactNode—The label
iconReactNode—A symbol before the label; with a label, iOS shows the symbol alone
aria-labelstring—Name of the segment for assistive technology, for a symbol alone
badgeReactNode | { content: ReactNode }—A count, read with the segment's name; drawn with the control's showBadges
disabledboolean—Disables the segment
testIDstring—Test id