# V toggle 6

> Toggle with notification count badge

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

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

## Install

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

## Files

### `registry/default/variants/v-toggle-6.tsx`

```tsx
"use client";

import { BellIcon } from "lucide-react";
import { useState } from "react";
import { Badge } from "@/registry/default/ui/badge";
import { Toggle } from "@/registry/default/ui/toggle";

export function Pattern() {
  const [pressed, setPressed] = useState(false);

  return (
    <div className="flex items-center justify-center">
      <Toggle
        aria-label="Toggle notifications"
        onPressedChange={setPressed}
        pressed={pressed}
      >
        <div className="relative">
          <BellIcon />
          {!pressed && (
            <Badge
              className="absolute -top-3 -right-3 h-fit rounded-full!"
              size="sm"
              variant="destructive"
            >
              3
            </Badge>
          )}
        </div>
      </Toggle>
    </div>
  );
}
```
