# Theme toggle

> Sun and moon icons flank a light / dark toggle.

A shadcn/ui block from the [@flx](https://ui.flexnative.com) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/flx/switch-06).

- Page, with a live preview: https://shadcn.exchange/r/flx/switch-06
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/flx/switch-06-light-a0c7fa4779e30402.png
- Registry item: https://ui.flexnative.com/r/switch-06.json
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://ui.flexnative.com/r/switch-06.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `switch`

## Files

### `registry/patterns/switch/switch-06.tsx`

```tsx
import { MoonIcon, SunIcon } from 'lucide-react'

import { Switch } from '@/components/ui/switch'

export function Switch06() {
  return (
    <div className="flex items-center gap-2.5">
      <SunIcon className="text-muted-foreground size-4" />
      <Switch defaultChecked aria-label="Toggle dark mode" />
      <MoonIcon className="text-muted-foreground size-4" />
    </div>
  )
}
```
