Badge
Inline status label with semantic color variants.
Installation
dgadd is not public on npm yet. Until the first release, pack @diffgazer/add from the repository and install that tarball into this app, which is what puts dgadd on pnpm exec.
The hosted registry is not public yet because r.b4r7.dev does not resolve. Use this source checkout or a local registry preview until the endpoint returns 200.
Diffgazer packages are not yet published to npm. Until the first release, pack @diffgazer/ui and @diffgazer/keys from the repository and install those tarballs.
UI components require Tailwind CSS v4. Local copy mode imports src/styles/styles.css; package mode uses @diffgazer/ui CSS once packages are available.
Usage
Examples
Variants
Sizes
Outline
API Reference
Badge
Accessibility
Notes
Uppercase Label
Badge renders its label uppercase with wide tracking — the terminal label voice used across the library. Pass mixed-case copy; the transform is presentational, so assistive tech still reads the original text.
Dot Prop
Set dot={true} to render a colored status indicator before the label content.
Outline Appearance
appearance="outline" drops the tinted fill and keeps the variant border and text color — for badges sitting on an already-tinted row or card.
Variant Colors Across Themes
Variants read theme tone tokens, so every tone carries the same hue family in both themes — success green, info blue, warning amber, error red — at the lightness each background needs. Override the --base-* primitives to retone them; the variant vocabulary stays the same.
Dynamic Content
For badges with content that updates (e.g., unread counts), add role="status" to the Badge for screen reader announcements. Static badges (labels like "Beta" or "New") need no additional ARIA.
Source
Install via CLI: pnpm exec dgadd add ui/badge.
Highlighted source loads after this disclosure opens. Browse the source repository.