Badge
A small label used to highlight status, category, or count.
- Status
- ReadyBuild day 2 of 21
- Code
- In React
- Role
- Display
Usage
This demo is live, and the code below it is the same code, imports included. The component lives in src/ui of this repository and is not published to npm yet.
Pastes as editable layers. Shadows are not exported.
import { useState } from "react";
import { Badge, Button, type BadgeTone } from "@/ui";
export default function BadgeDemo() {
const [paid, setPaid] = useState<boolean>(false);
const tone: BadgeTone = paid ? "success" : "warning";
return (
<>
<span>Invoice INV-0042</span>
<Badge tone={tone}>{paid ? "Paid" : "Pending"}</Badge>
<Button variant="ghost" onClick={() => setPaid(!paid)}>
{paid ? "Mark as pending" : "Mark as paid"}
</Button>
</>
);
}Variants and states
Every specimen is the real component from src/ui, held in one state.
Pastes as editable layers. Shadows are not exported.
Props
- tone
- "neutral" | "primary" | "secondary" | "info" | "success" | "warning" | "danger" · default "neutral"
- Color for the meaning. Always pair it with text. info is the older name for primary.
- type
- "solid" | "subtle" | "outline" · default "subtle"
- Solid fill, soft fill, or an outline.
- size
- "sm" | "md" · default "md"
- 16px or 20px tall.
- iconLeft, iconRight
- ReactNode · default none
- Decorative icon before or after the label. Hidden from screen readers.
- children
- ReactNode · default none
- The label. The type does not require it, but a badge without text has no meaning.
- className
- string · default ""
- Extra classes, added after the tone classes.
- ...rest
- HTMLAttributes<HTMLSpanElement> · default none
- Every other native span attribute, such as id or title.
Figma to code
Figma properties by their exact names from Naming, and the React prop that carries each one. The table covers the shared properties that bear on this component; the Figma file decides which of them its component exposes. None means there is no prop for it yet.
- 🎨 Tone
- tone
- Same name and the same semantic values.
- 🧰 Type
- type
- solid, subtle, or outline.
- Show Icon Left, Change Icon Left
- iconLeft
- Pass an icon element to show it.
- Show Icon Right, Change Icon Right
- iconRight
- Pass an icon element to show it.
- 🖍 Label
- children
- The text inside the badge.
- 📐 Size
- size
- sm or md.
- 🎯 State
- None
- No prop. A badge is not interactive, so it has no states.
Accessibility
What the code in src/ui does today, and what it leaves to you.
Keyboard
- Not focusable and not interactive. Tab skips it.
Screen readers
- Read as plain inline text, in reading order. It has no role.
- The tone color is not announced. Only the text is.
What you still need to do
- Put the meaning in the text, such as Paid or Failed, never in the color alone.
- If a badge changes while someone is on the page, the change is not announced. Use a live region when they need to hear it.
When to use
Statuses (Paid, Pending, Overdue), counts, or tags.
Do and don't
Do
- Use consistent colors for the same meaning across the product.
- Keep badge text short: one or two words.
Don't
- Use more than one badge per item unless necessary.
- Rely on color alone to convey meaning: add text too.
Related
4 of 16 other atoms, same role and ready ones first.
- AvatarA visual representation of a user, team, or entity.Ready
- ChipA compact label for a category, filter, or selected value.Ready
- CommentA single message in a discussion, with author, time, and text.Ready
- HeadlineA page or section title set in the Urbanist header scale.Ready
Status reflects the component tracker snapshot of 29 October 2026.