---
title: Switch
description: A control that allows the user to toggle between checked and not checked.
author:
  name: imskyleen
  url: https://github.com/imskyleen
---

<ComponentPreview name="radix-switch-demo" />

## Installation

<ComponentInstallation name="radix-switch" />

## Usage

```tsx
<Switch />
```

## Props

<div className="flex flex-row gap-x-3">
  <ExternalLink
    href="https://www.radix-ui.com/primitives/docs/components/switch"
    text="Docs"
  />
  <ExternalLink
    href="https://www.radix-ui.com/primitives/docs/components/switch#api-reference"
    text="API Reference"
  />
</div>

### Animate UI props

<TypeTable
  type={{
    leftIcon: {
      description: 'The icon to display on the left of the switch',
      type: 'React.ReactNode',
      required: false,
    },
    rightIcon: {
      description: 'The icon to display on the right of the switch',
      type: 'React.ReactNode',
      required: false,
    },
    thumbIcon: {
      description: 'The icon to display on the thumb of the switch',
      type: 'React.ReactNode',
      required: false,
    },
  }}
/>

## Credits

- We use [Radix UI](https://www.radix-ui.com/primitives/docs/components/switch) for the switch component.
- We take our inspiration from [Shadcn UI](https://ui.shadcn.com/docs/components/switch) for the switch style.
