Badge

Free

A fixed fact about a run as a tag, a badge inline in a table, or a small count beside a name, in the locked status colors with solid icons cut from the free Hugeicons.

npx shadcn@latest add https://pixilui.com/r/badge.json

Preview

Solid icons cut from the outlines, in the locked status colors.
Show
Size

When to use

Use it when

  • A fixed fact about a run or a row: Pass, Fail, Needs review, Uses tools (BadgeTag).
  • The same fact inline in a table cell or a meta line, icon and word with no pill (Badge).
  • A number beside a name in a nav or a heading, or a dot for something new (BadgeCount).

Use something else when

  • A state that changes while you watch: use Agent status, the pill with the live mark.
  • Something a person can remove or press: use Chip.
  • Decoration: every tone means a status or a kind of work.

Installation

Terminal
npx shadcn@latest add https://pixilui.com/r/badge.json

Adds badge.tsx, and installs clsx and tailwind-merge. The URL works in any app with a components.json, with no registry to add first.

Usage

example.tsx
import { Badge } from "@/components/pixilui/badge";

<Badge>Save changes</Badge>

A tag keeps its words on one line; a badge wraps with the line it sits in.

API reference

PropTypeDefault
tone"neutral" | "ok" | "bad" | "wait" | "think" | "read" | "tool" | "edit"–ok, bad, wait and think are the status colors; read, tool and edit the meaning hues; neutral is grey.
size"md" | "sm"–md 30 (the default), sm 24. Not used inline.
iconReactNode–A leading icon, usually a BadgeIcon.
childrenReactNode–The words.

Keyboard

TabNever takes focus: tags, badges and counts are not interactive.

Accessibility

  • Tags and badges are text: the word carries the meaning, and the icon is aria-hidden.
  • Never color alone: each tone pairs its hue with a word and, where given, its own solid icon.
  • A count is text; a dot count has no text, so give it an aria-label ("New").
  • Every word passes 4.5:1 in both themes.

Motion

  • None: a tag is a fixed fact. A state that changes belongs in Agent status.
ChipA removed chip folds away while the row closes the gap.
Agent statusA run's status fills as it goes and closes into its result, so it never jumps.
Status dotOne node for every run state, so waiting on you looks the same everywhere.

PixilUI Pro opens soon. The first 20 licenses are $99.