Skip to content
Haze UI

Tag

Small pill that names a state such as Paid, Past due or Failed, in five variants and three appearances with an optional dot.

pnpm dlx shadcn@latest add @haze/tag
Open preview in a new tab
Liveno JavaScript

When to use

  • Showing the state of a row or record: paid, syncing, failed
  • A state label next to a title in a card header or an item row
  • Short status words where the color adds to the text, not replaces it

When not to use

  • Neutral metadata such as a version number or a category; badge is quieter and has no status colors
  • A status the user must act on right away; use alert, which can carry a message and a button

Installation

Add the Haze registry to components.json once, then install Tag with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/tag
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
variant"default" | "info" | "success" | "warning" | "destructive""default"Color. default is neutral; the other four use the brand and status colors.
appearance"soft" | "outline" | "solid""soft"soft is a tinted fill with no border. outline is a hairline in the tag's own color. solid is a full fill, for the one tag that must stand out.
size"sm" | "md""md"Text 11 px or 12 px.
dotbooleanfalseAdds a small colored dot before the text.
classstring–Extra classes.
default slot*slot–The status word. Keep it to one or two words.

Accessibility

  • The text is the status; the tint and the aria-hidden dot only reinforce it, so a user who cannot tell the colors apart loses nothing (WCAG 1.4.1).
  • Soft tags use a 14% tint with no border, and their text color is tuned for the dark theme; check the contrast again if you change the tokens.
  • Tag is a plain span with no live region, so a status that changes on screen needs its own announcement.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI component "Tag" with `npx shadcn@latest add @haze/tag`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import Tag from "@/components/haze/ui/tag.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/ui/tag.md

  • Customize with real content

    Adapt the Haze tag ui for our product. Replace the demo values of these props with our real content: variant, appearance, size, dot, class, default slot. Keep the layout, the heading level rules and these accessibility details: The text is the status; the tint and the aria-hidden dot only reinforce it, so a user who cannot tell the colors apart loses nothing (WCAG 1.4.1). Soft tags use a 14% tint with no border, and their text color is tuned for the dark theme; check the contrast again if you change the tokens. Tag is a plain span with no live region, so a status that changes on screen needs its own announcement. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using tag, check it fits: use it when showing the state of a row or record: paid, syncing, failed; a state label next to a title in a card header or an item row; short status words where the color adds to the text, not replaces it. Avoid it when neutral metadata such as a version number or a category; badge is quieter and has no status colors; a status the user must act on right away; use alert, which can carry a message and a button. Alternatives: @haze/badge, @haze/status, @haze/alert.

Dependencies

  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog