---
modificationDate: May 06, 2026
title: Switch
description: A toggle control that switches between on and off states.
sourceCodeUrl: 'https://github.com/expo/expo/tree/sdk-56/packages/expo-ui'
packageName: '@expo/ui'
platforms: ['android', 'ios', 'web', 'expo-go']
---

<AgentInstructions>

## Submitting Feedback

If this page contains errors, outdated information, or gaps that blocked you from completing a task, report it so the docs can be improved:

curl -X POST https://api.expo.dev/v2/feedback/docs-send -H 'Content-Type: application/json' -d '{"url":"/versions/v56.0.0/sdk/ui/universal/switch/","feedback":"🤖 Agent feedback: <specific, actionable description>"}'

Only submit when you have something specific and actionable to report.

</AgentInstructions>

# Switch

A toggle control that switches between on and off states.
Android, iOS, Web, Included in Expo Go

> For the complete documentation index, see [llms.txt](/llms.txt). Use this file to discover all available pages.

A controlled toggle. Pair [`value`](/versions/v56.0.0/sdk/ui/universal/switch#value) with [`onValueChange`](/versions/v56.0.0/sdk/ui/universal/switch#onvaluechange) to manage state from React.

## Installation

```sh
npx expo install @expo/ui
```

If you are installing this in an [existing React Native app](/bare/overview), make sure to [install `expo`](/bare/installing-expo-modules) in your project.

## Usage

### Basic switch

```tsx
import { useState } from 'react';
import { Host, Switch } from '@expo/ui';

export default function SwitchExample() {
  const [enabled, setEnabled] = useState(false);

  return (
    <Host matchContents>
      <Switch value={enabled} onValueChange={setEnabled} />
    </Host>
  );
}
```

### With label

When `label` is provided, the switch is rendered alongside its text in a labeled row.

```tsx
import { useState } from 'react';
import { Host, Switch } from '@expo/ui';

export default function LabeledSwitchExample() {
  const [notifications, setNotifications] = useState(true);

  return (
    <Host style={{ flex: 1 }}>
      <Switch label="Enable notifications" value={notifications} onValueChange={setNotifications} />
    </Host>
  );
}
```

## API

```tsx
import { Switch } from '@expo/ui';
```

## Component

### `Switch`

Supported platforms: Android, iOS, Web.

Type: React.[Element](https://www.typescriptlang.org/docs/handbook/jsx.html#function-component)<[SwitchProps](#switchprops)\>

A toggle control that switches between on and off states.

Props for the [`Switch`](#switch) component, a toggle control.

SwitchProps

### `disabled`

Supported platforms: Android, iOS, Web.

Optional • Type: `boolean`

Whether the switch is disabled. Disabled switches do not respond to user interaction.

### `label`

Supported platforms: Android, iOS, Web.

Optional • Type: `string`

Text label displayed alongside the switch.

### `modifiers`

Supported platforms: Android, iOS, Web.

Optional • Type: `ModifierConfig[]`

Platform-specific modifier escape hatch. Pass an array of modifier configs from `@expo/ui/swift-ui/modifiers` or `@expo/ui/jetpack-compose/modifiers`.

### `onValueChange`

Supported platforms: Android, iOS, Web.

Type: `(value: boolean) => void`

Called when the user toggles the switch.

### `testID`

Supported platforms: Android, iOS, Web.

Optional • Type: `string`

Identifier used to locate the component in end-to-end tests.

### `value`

Supported platforms: Android, iOS, Web.

Type: `boolean`

Whether the switch is on.
