Badge03
A small, loud label for a status or a category. In Comic it jumps and tilts when you point at it; in Arcade it blinks like "insert coin".
<Badge>New</Badge>Usage
import { Badge } from "plonk-ui";
export function Status() {
return <Badge variant="success">Live</Badge>;
}Badge is a <span> and isn't interactive. Put it next to the thing it
describes, inside a card header, a table cell or a list row.
Variants
Each variant is a fill color from the personality's palette, with its matching text color, so the pair always passes contrast.
import { Badge } from "plonk-ui";
export default function Variants() {
return (
<div className="flex flex-wrap items-center gap-2">
<Badge>Neutral</Badge>
<Badge variant="primary">Primary</Badge>
<Badge variant="secondary">Secondary</Badge>
<Badge variant="accent">Accent</Badge>
<Badge variant="success">Success</Badge>
<Badge variant="warning">Warning</Badge>
<Badge variant="danger">Danger</Badge>
</div>
);
}Status dot
dot adds a small dot before the text, which helps a list of statuses scan at a
glance. The text still says the status; the color only supports it.
- docsLive
- apiBuilding
- billingFailed
import { Badge } from "plonk-ui";
const DEPLOYS = [
{ name: "docs", status: "Live", variant: "success" },
{ name: "api", status: "Building", variant: "warning" },
{ name: "billing", status: "Failed", variant: "danger" },
] as const;
export default function Status() {
return (
<ul className="flex w-full max-w-xs flex-col gap-3">
{DEPLOYS.map((deploy) => (
<li key={deploy.name} className="flex items-center justify-between">
<span className="font-bold">{deploy.name}</span>
<Badge variant={deploy.variant} dot>
{deploy.status}
</Badge>
</li>
))}
</ul>
);
}Personalities
Sticker and Retro keep the badge still. Comic makes it pop: it grows and tilts under the pointer. Arcade blinks it three times. Both only react to a mouse, not to touch. With reduced motion, Arcade's blinking stops and Comic's pop becomes a short, plain ease.
Accessibility
- A badge is plain text: screen readers read its content where it sits.
- Don't rely on color alone. "Failed" in red is clear; a red dot by itself isn't.
- The dot is hidden from screen readers.
API
All other <span> props are passed through.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "neutral" | "primary" | "secondary" | "accent" | "success" | "warning" | "danger" | "neutral" | Fill color, from the personality's palette. |
dot | boolean | false | A small status dot before the text, in the text color. |