Loading component…
Loading component…
A small status label that carries the color – six soft tones, a leading dot or icon, a live dot that pulses while something runs and a round count up to 99+
To reuse this local React demo, copy all files from the Code tab into the same folder, then import Badge from ./badge.
import { Badge } from "@/components/ui/badge";
type Run = { id: string; title: string; status: "running" | "waiting" | "done" | "failed" | "queued" };
const STATUS = {
running: <Badge tone="info" live>Running</Badge>,
waiting: <Badge tone="warning" dot>Needs you</Badge>,
done: <Badge tone="success">Done</Badge>,
failed: <Badge tone="danger">Failed</Badge>,
queued: <Badge>Queued</Badge>,
};
export function RunRow({ run }: { run: Run }) {
return (
<div style={{ display: "flex", alignItems: "center", gap: 12 }}>
<span style={{ flex: 1, minWidth: 0 }}>{run.title}</span>
{STATUS[run.status]}
</div>
);
}| Name | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | The text – one or two words. Long text ends in … at the badge's max-width (100% of its container) | |
| tone | "neutral" \| "info" \| "success" \| "warning" \| "danger" \| "purple" | "neutral" | neutral: gray · info: blue, running · success: green, done · warning: orange, needs you · danger: red, failed · purple: a kind, like Beta. A soft tint with text in the same color |
| size | "sm" \| "md" | "sm" | 20px high with 11px text, or 22px with 12px – a full pill |
| dot | boolean | A small dot in the tone's color before the text | |
| live | boolean | The dot pulses softly – for running, live and recording. Implies dot | |
| icon | ReactNode \| HugeIcon | An icon before the text – an inline SVG, or a Hugeicons icon object drawn inline. Takes the badge's color | |
| count | number | Makes it a round count: the number instead of children, formatted for the reader's locale, never below 0. A badge with no text, count, dot or icon (e.g. count={NaN}) renders nothing | |
| max | number | 99 | Above it a count reads max+, e.g. 99+ |
| ...span props | ComponentProps<"span"> | className, title, aria-label, dir, ref and the rest go to the <span> |
Never wraps: long text shortens with … inside its row instead
Numbers use tabular figures, so counts don't jitter as they change
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"
@import "tailwindcss"; in your main CSS file.