# V group 15

> Text formatting toolbar

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

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

## Install

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

## Files

### `registry/default/variants/v-group-15.tsx`

```tsx
"use client";

import { ThumbsDownIcon, ThumbsUpIcon } from "lucide-react";
import { useState } from "react";
import { Badge } from "@/registry/default/ui/badge";
import { Button } from "@/registry/default/ui/button";
import { Group, GroupSeparator } from "@/registry/default/ui/group";

export default function Particle() {
  const [votes, setVotes] = useState({ down: 4, up: 42 });
  const [voted, setVoted] = useState<"up" | "down" | null>(null);

  const vote = (dir: "up" | "down") => {
    setVotes((v) => {
      if (voted === dir) return { ...v, [dir]: v[dir] - 1 };
      const next = { ...v, [dir]: v[dir] + 1 };
      if (voted) next[voted] = v[voted] - 1;
      return next;
    });
    setVoted((prev) => (prev === dir ? null : dir));
  };

  return (
    <Group aria-label="Helpfulness vote">
      <Button
        aria-label="Helpful"
        aria-pressed={voted === "up"}
        onClick={() => vote("up")}
        variant={voted === "up" ? "secondary" : "outline"}
      >
        <ThumbsUpIcon aria-hidden="true" />
        Helpful
        <Badge className="-me-1" variant="secondary">
          {votes.up}
        </Badge>
      </Button>
      <GroupSeparator />
      <Button
        aria-label="Not helpful"
        aria-pressed={voted === "down"}
        onClick={() => vote("down")}
        variant={voted === "down" ? "secondary" : "outline"}
      >
        <ThumbsDownIcon aria-hidden="true" />
        Not helpful
        <Badge className="-me-1" variant="secondary">
          {votes.down}
        </Badge>
      </Button>
    </Group>
  );
}
```
