# Badge preview

Interactive preview of the CyberSpec Badge component. A small cut label in seven tones, with count and status variants.

[View Badge preview on CyberSpec](https://www.cyberspec.dev/preview/badge)

## About this preview

Badge belongs to the Data group in the CyberSpec catalog. It uses markup and CSS.

## Installation

Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.

```sh
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/badge.json
```

## Example

```tsx
"use client"

import { Badge } from "@/components/ui/badge"

export default function BadgeDemo() {
  return (
    <>
      <Badge tone="flag">New</Badge>
      <Badge>Tracked</Badge>
      <Badge tone="signal">Agent</Badge>
      <Badge tone="rare">Rare</Badge>
      <Badge tone="epic">Epic</Badge>
      <Badge tone="mute">Archived</Badge>
      <Badge tone="ok" status live>
        Online
      </Badge>
      <Badge tone="mute" status>
        No signal
      </Badge>
      <Badge tone="flag" count={3} label="unread messages" />
      <Badge tone="signal" count={42} label="daemons queued" />
      <Badge tone="flag" count={128} label="items in the stash" />
    </>
  )
}
```

## Install this example

```sh
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/badge-demo.json
```

## Resources

- [Badge documentation](https://www.cyberspec.dev/components/sidebar/badge.md)
- [Component catalog](https://www.cyberspec.dev/components.md)
- [Badge source code](https://github.com/agnelnieves/cyberspec/blob/main/registry/cyber/ui/badge.tsx)
- [Shadcn registry item](https://www.cyberspec.dev/r/badge.json)
