# V switch 7

> Compact settings table with switches

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

- Page, with a live preview: https://shadcn.exchange/r/cnippet/v-switch-7
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/cnippet/v-switch-7-light-665e4ab360a1c2f9.png
- Registry item: https://ui.cnippet.dev/r/v-switch-7.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-7.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-7.tsx`

```tsx
import { Separator } from "@/registry/default/ui/separator";
import { Switch } from "@/registry/default/ui/switch";

const settings = [
  {
    checked: true,
    description: "Save changes automatically",
    id: "auto-save",
    label: "Auto-save",
  },
  {
    checked: true,
    description: "Highlight spelling errors",
    id: "spell-check",
    label: "Spell check",
  },
  {
    checked: false,
    description: "Show line numbers in editor",
    id: "line-numbers",
    label: "Line numbers",
  },
];

export function Pattern() {
  return (
    <div className="mx-auto w-full max-w-md">
      <p className="mb-3 font-medium text-sm">Editor Preferences</p>
      <Separator />
      <div className="flex flex-col">
        {settings.map((setting) => (
          <label
            className="flex cursor-pointer items-center justify-between border-b py-3 last:border-b-0"
            htmlFor={setting.id}
            key={setting.id}
          >
            <div className="flex flex-col gap-0.5">
              <span className="font-medium text-sm">{setting.label}</span>
              <span className="text-muted-foreground text-xs">
                {setting.description}
              </span>
            </div>
            <Switch
              defaultChecked={setting.checked}
              id={setting.id}
              size="sm"
            />
          </label>
        ))}
      </div>
    </div>
  );
}
```
