Badge

A small cut label in seven tones, with count and status variants.

Component

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.

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

Example

"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

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

Resources

View as Markdown