Skip to content
Unkey Design Docs
Esc
↑↓navigate↵open⌘Jpreview
On this page

Badge

A small label for a status, a count or a code value.

import { Badge } from "@unkey/ui";

export default function BadgeVariants() {
  return (
    <div className="flex flex-wrap items-center gap-2">
      <Badge>Primary</Badge>
      <Badge variant="secondary">Secondary</Badge>
      <Badge variant="success">Ready</Badge>
      <Badge variant="warning">Building</Badge>
      <Badge variant="blocked">Blocked</Badge>
      <Badge variant="error">Failed</Badge>
      <Badge variant="count">3</Badge>
      <Badge variant="code">acme-api</Badge>
    </div>
  );
}

Variants

  • primary, secondary: neutral labels.
  • success, warning, error: status. Pick by the state, not by the color you want.
  • blocked: status for a refused request, for example a disabled or expired key. A deployment that waits for approval uses warning.
  • count: a number next to a tab or a heading.
  • code: a slug, an ID or a branch name in running text. It truncates to its container and keeps the line height of the text around it.

Sizes

import { Badge } from "@unkey/ui";

export default function BadgeSizes() {
  return (
    <div className="flex flex-wrap items-center gap-2">
      <Badge variant="success">Default</Badge>
      <Badge variant="success" size="sm">
        Small
      </Badge>
      <Badge variant="success" size="compact">
        <span className="size-1.5 rounded-full bg-success-9" />
        Compact
      </Badge>
    </div>
  );
}
  • Default: 22px high.
  • sm: 22px high, with tighter horizontal padding.
  • compact: 20px high. Use it for a status dot or an icon and a label inside a dense header row. It adds a gap between the dot and the label.