Skip to main content
Version: 5.1.3

Switch

Switch represents user's decision of a process and indicates whether a state is on/off. Switch is a controlled component that requires an onValueChange to update the value prop. This renders a boolean value. React Native vElements provide you with additional theme and color support in the Switch Button.

Import

import { Switch } from '@rn-vui/themed';

Theme Key

Switch

Usage

function RNESwitch() {
const [open, setOpen] = React.useState(false);
return (
<Stack row align="center">
<Switch value={open} onValueChange={setOpen} />
</Stack>
);
}

Props

note

Includes all React Native Switch, View props.

NameTypeDefaultDescription
colorstringprimaryThe color of the Switch component.

Playground

Loading...