# V group 14

> With Select

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

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

```tsx
"use client";

import {
  BoldIcon,
  ItalicIcon,
  StrikethroughIcon,
  UnderlineIcon,
} from "lucide-react";
import { Fragment, useState } from "react";
import { Button } from "@/registry/default/ui/button";
import { Group, GroupSeparator } from "@/registry/default/ui/group";

const formats = [
  { icon: BoldIcon, label: "Bold", value: "bold" },
  { icon: ItalicIcon, label: "Italic", value: "italic" },
  { icon: UnderlineIcon, label: "Underline", value: "underline" },
  { icon: StrikethroughIcon, label: "Strikethrough", value: "strikethrough" },
] as const;

export default function Particle() {
  const [active, setActive] = useState<Set<string>>(new Set(["bold"]));

  const toggle = (value: string) => {
    setActive((prev) => {
      const next = new Set(prev);
      next.has(value) ? next.delete(value) : next.add(value);
      return next;
    });
  };

  return (
    <Group aria-label="Text formatting">
      {formats.map((fmt, i) => (
        <Fragment key={fmt.value}>
          {i > 0 && <GroupSeparator />}
          <Button
            aria-label={fmt.label}
            aria-pressed={active.has(fmt.value)}
            onClick={() => toggle(fmt.value)}
            size="icon"
            variant={active.has(fmt.value) ? "secondary" : "outline"}
          >
            <fmt.icon aria-hidden="true" />
          </Button>
        </Fragment>
      ))}
    </Group>
  );
}
```
