This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 54).

Switch

A Jetpack Compose Switch component for toggle controls.

Android

A switch component that provides toggle functionality with different visual styles.

Installation

Terminal
npx expo install @expo/ui

If you are installing this in an existing React Native app, make sure to install expo in your project.

Toggle switch

Note: also known as Toggle.

import { Switch } from '@expo/ui/jetpack-compose'; <Switch value={checked} onValueChange={checked => { setChecked(checked); }} color="#ff0000" label="Play music" variant="switch" />

See official Jetpack Compose documentation for more information.

Checkbox

import { Switch } from '@expo/ui/jetpack-compose'; <Switch value={checked} onValueChange={checked => { setChecked(checked); }} label="Play music" color="#ff0000" variant="checkbox" />

See official Jetpack Compose documentation for more information.

API

import { Switch } from '@expo/ui/jetpack-compose';

No API data file found, sorry!