# V switch 13

> Dark Mode Toggle Card

A shadcn/ui block from the [@cnippet](https://ui.cnippet.dev/) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/cnippet/v-switch-13).

- Page, with a live preview: https://shadcn.exchange/r/cnippet/v-switch-13
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/cnippet/v-switch-13-light-5cc25da59ed916f0.png
- Registry item: https://ui.cnippet.dev/r/v-switch-13.json
- Categories: switch
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://ui.cnippet.dev/r/v-switch-13.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: `@cnippet/switch`

## Files

### `registry/default/variants/v-switch-13.tsx`

```tsx
"use client";

import { MoonIcon, SunIcon } from "lucide-react";
import { useState } from "react";
import { Switch } from "@/registry/default/ui/switch";

export default function Particle() {
  const [dark, setDark] = useState(false);

  return (
    <div
      className={`flex w-full max-w-xs flex-col items-center gap-6 rounded-2xl border p-8 transition-colors duration-300 ${dark ? "border-zinc-700 bg-zinc-900 text-white" : "bg-white text-zinc-900"}`}
    >
      <div
        className={`flex size-16 items-center justify-center rounded-full transition-colors duration-300 ${dark ? "bg-zinc-800" : "bg-amber-50"}`}
      >
        {dark ? (
          <MoonIcon aria-hidden="true" className="size-7 text-indigo-400" />
        ) : (
          <SunIcon aria-hidden="true" className="size-7 text-amber-500" />
        )}
      </div>
      <div className="text-center">
        <p className="font-semibold">{dark ? "Dark Mode" : "Light Mode"}</p>
        <p
          className={`text-sm ${dark ? "text-zinc-400" : "text-zinc-500"} mt-1`}
        >
          {dark ? "Easy on the eyes at night" : "Crisp and clear in daylight"}
        </p>
      </div>
      <div className="flex items-center gap-3">
        <SunIcon
          aria-hidden="true"
          className={`size-4 ${dark ? "text-zinc-500" : "text-amber-500"}`}
        />
        <Switch
          checked={dark}
          className="data-checked:bg-indigo-600"
          onCheckedChange={setDark}
        />
        <MoonIcon
          aria-hidden="true"
          className={`size-4 ${dark ? "text-indigo-400" : "text-zinc-400"}`}
        />
      </div>
    </div>
  );
}
```
