Mobile › Inputs

SegmentedControl

Two to five equal options in one row, such as Day, Week and Month.

Installation

npx expo install plankui-mobile react-native-safe-area-context expo-haptics

Usage

import { SegmentedControl } from "plankui-mobile";

const [range, setRange] = useState(0);

<SegmentedControl options={["Day", "Week", "Month"]} value={range} onChange={setRange} accessibilityLabel="Range" />

iOS and Android

iOS: A grey track with a white thumb that slides to the selection.

Android: Material 3 segmented buttons: outlined, with a check on the selected one.

API reference

PropTypeDefaultDescription
optionsstring[]Two to five labels.
valuenumberIndex of the selected option.
onChange(index: number) => voidCalled with the tapped index.
accessibilityLabelstring–Names the group for screen readers.