Xzero UI
Pro library

Badge

A small label for status, category, or metadata.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/badge
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/badge

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { Check } from "lucide-react";
import { Badge } from "@/components/xzero/badge/badge";

export function DeployStatus({ live }: { live: boolean }) {
  return (
    <Badge tone={live ? "success" : "neutral"} icon={live ? <Check size={12} /> : undefined}>
      {live ? "Live" : "Draft"}
    </Badge>
  );
}

API reference

Badge

A small status pill whose label and icon morph in place when they change.

PropTypeDefaultDescription
tone"neutral" | "success" | "info" | "warning" | "danger""neutral"Color of the pill.
size"sm" | "md""md"Height and text size.
iconReactNode–Leading icon. A different icon component crossfades in.
childrenReactNode–Label. String or number children get the rolling text swap; other nodes render as is.
...propsHTMLAttributes<HTMLSpanElement>–Forwarded to the root span.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in avatars

Guidance for AI tools

Badge: A small label for status, category, or metadata. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components