# Switch: On and off marks

> `icons` adds a check and a ring to the track, so the state doesn't rely on color.

Example: https://hextaui.com/docs/switch/examples/icons
Component docs: https://hextaui.com/docs/switch.md

## Add this example

```bash
npx shadcn@latest add https://hextaui.com/r/switch-icons.json
```

This adds `components/examples/switch/icons.tsx` with the Switch component and the HextaUI theme tokens.

## Source

```tsx title="components/examples/switch/icons.tsx"
import { Switch } from "@/components/ui/switch"

export function SwitchIcons() {
  return (
    <div className="flex flex-col gap-4 text-sm">
      <label className="flex items-center gap-3">
        <Switch icons defaultChecked />
        Captions
      </label>
      <label className="flex items-center gap-3">
        <Switch icons size="lg" />
        Reduce transparency
      </label>
    </div>
  )
}
```

## Props in this example

### Switch

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `defaultChecked` | `boolean` | `false` |  |
| `size` | `"sm" \| "default" \| "lg"` | `"default"` |  |
| `icons` | `boolean` | `false` | Show on and off marks in the track. |

## More Switch examples

- [iOS](https://hextaui.com/docs/switch/examples/ios.md)
- [Saving](https://hextaui.com/docs/switch/examples/async.md)
- [Sizes](https://hextaui.com/docs/switch/examples/sizes.md)
- [In a field](https://hextaui.com/docs/switch/examples/field.md)
- [Disabled and read-only](https://hextaui.com/docs/switch/examples/states.md)
- [Controlled](https://hextaui.com/docs/switch/examples/controlled.md)
- [Right to left](https://hextaui.com/docs/switch/examples/rtl.md)
