# P badge 19

> Selectable badge with checkbox

A shadcn/ui block from the [@coss](https://coss.com/ui) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/coss/p-badge-19).

- Page, with a live preview: https://shadcn.exchange/r/coss/p-badge-19
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/coss/p-badge-19-light-e2229f1c236215b0.png
- Registry item: https://coss.com/ui/r/p-badge-19.json
- Categories: badge, checkbox
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://coss.com/ui/r/p-badge-19.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- npm packages: `lucide-react`
- Registry items: `@coss/badge`, `@coss/checkbox`

## Files

### `registry/default/particles/p-badge-19.tsx`

```tsx
"use client";

import { CheckIcon } from "lucide-react";
import { useId } from "react";
import { Badge } from "@/registry/default/ui/badge";
import { Checkbox } from "@/registry/default/ui/checkbox";

export default function Particle() {
  const id = useId();
  return (
    <Badge className="relative outline-none has-focus-visible:border-ring has-data-unchecked:bg-muted has-data-unchecked:text-muted-foreground has-focus-visible:ring-[3px] has-focus-visible:ring-ring/50">
      <Checkbox className="peer hidden" defaultChecked id={id} />
      <CheckIcon
        aria-hidden="true"
        className="hidden peer-data-checked:block"
      />
      <label
        className="cursor-pointer select-none after:absolute after:inset-0"
        htmlFor={id}
      >
        Selectable
      </label>
    </Badge>
  );
}
```
