Skip to Content
Getting startedFoundationsComponentsPackagesTools

Badge

A short status word, in one of six tones, subtle or solid.

Examples

subtleActive
solidActive
neutralActive
primaryActive
infoActive
successActive
warningActive
errorActive

Install

npx shadcn add @hipuku/badge

Usage

import { Badge } from '@/components/haus/components/Badge'

<Badge tone="success">Shipped</Badge>

API

Badge also takes the attributes every HTML element has and forwards its ref. className lands on the root.

PropTypeDescription
tone"neutral" | "info" | "success" | "warning" | "error" | "primary"
appearance"subtle" | "solid"
dotboolean
as"span" | "output" | "dd" | "li"The element to render. A count in a definition list or a live result is a <dd> or an <output>, not a <span>.

Tones

neutral, info, success, warning and error carry meaning. primary is the brand colour and carries none. Each tone is subtle or solid through appearance.

Choosing the element

as sets the element when a span is wrong: a count in a definition list is a dd, and a value that updates is an output, which a screen reader announces when it changes.

Accessibility

  • Read as its text and takes no focus.
  • The word carries the meaning, never the colour alone: write a label that stands on its own.

On this page