Mobile › Inputs

Switch

An on-off toggle that takes effect straight away, usually at the end of a list row.

Installation

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

Usage

import { Switch, ListItem } from "plankui-mobile";

const [push, setPush] = useState(true);

<ListItem title="Push notifications" right={<Switch value={push} onValueChange={setPush} />} />

iOS and Android

iOS: The native iOS switch with a white thumb, in the accent colour.

Android: The Material 3 switch with a thumb that grows when on.

API reference

PropTypeDefaultDescription
valuebooleanOn or off.
onValueChange(v: boolean) => voidCalled with the new value.
disabledbooleanfalseDims and blocks taps.
accessibilityLabelstring–Required when there is no visible label next to it.