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-hapticsUsage
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
| Prop | Type | Default | Description |
|---|---|---|---|
| value | boolean | On or off. | |
| onValueChange | (v: boolean) => void | Called with the new value. | |
| disabled | boolean | false | Dims and blocks taps. |
| accessibilityLabel | string | – | Required when there is no visible label next to it. |