2025-08-20 04:12:49 -06:00

60 lines
1.3 KiB
Plaintext

---
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.