# Switch

> An on/off switch over a native checkbox, so focus, keyboard, forms and screen readers come from the browser.

Section: Forms. Docs: https://entrepta.vercel.app/docs/components/switch

## Install

```bash
npx @entrepta/cli@latest add switch
```

Files: `primitives/switch.tsx`.
No npm packages.

## Usage

```tsx
import { Switch } from "@/components/entrepta/switch"

<Switch label="send me a copy" defaultChecked />
<Switch label="notifications" checked={on} onChange={(e) => setOn(e.target.checked)} />
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `ReactNode` | - | Clickable label next to the switch |
| `checked` | `boolean` | - | Controlled state |
| `defaultChecked` | `boolean` | - | Uncontrolled starting state |
| `disabled` | `boolean` | false | Dims and disables |
