Skip to content

Badge

A small inline status chip with intent coloring, soft, solid, and outline variants, the shared rounded scale, and an optional dismiss button. It is the building block for selected-option chips.

Import

import { Badge } from "@hyzer-labs/ui"

Demo

The intent vocabulary. The text carries the meaning; color reinforces it.

Casual League Doubles OB Windy Birdie Cart friendly
<Badge>Casual</Badge>
<Badge intent="primary">League</Badge>
<Badge intent="secondary">Doubles</Badge>
<Badge intent="danger">OB</Badge>
<Badge intent="warning">Windy</Badge>
<Badge intent="success">Birdie</Badge>
<Badge intent="info">Cart friendly</Badge>

Props

NameTypeDefaultNote
childrenSnippetRequired. The badge content.
intentIntent'neutral'See Foundation → Colors & Intent.
variant'soft' | 'solid' | 'outline''soft'
size'sm' | 'md''md'
rounded'none' | 'sm' | 'md' | 'lg' | 'full''full'The shared Rounded scale — 1:1 with the --hz-radius-* tokens.
onDismiss() => voidRenders the trailing remove button (the chip form).
dismissLabelstring'Remove'In lists, pass a per-item label — "Remove" alone is ambiguous.
classstringMerged after the hz-badge class.

Theme hooks

What this component promises your CSS. The reference theme styles exactly these — from @layer hz-theme, so your unlayered rules win. See Styling Components for the how.

Root class: .hz-badge

Data attributes

HookValuesStyles
data-intent'neutral' | any registered intentSpans the intent registry.
data-variant'soft' | 'solid' | 'outline'Default soft.
data-size'sm' | 'md'Two rungs only, unlike Button. Default md.
data-rounded'none' | 'sm' | 'md' | 'lg' | 'full'Default full — the pill.
data-dismissiblepresent when dismissibleMarks the chip form. Always stamped so you can target it.

Custom properties

HookValuesStyles
--hz-badge-tint<percentage> — 14% light, 28% darkSoft-variant background tint strength.

Part classes

HookValuesStyles
.hz-badge-dismisschild elementThe remove button.

Accessibility

A badge is plain inline text with no role and no label, so it announces as part of the surrounding content. Never let the intent color be the only signal; the text itself carries the meaning.

The dismiss button is a real <button> named by dismissLabel, with a decorative icon. When rendering several chips, give each a per-item label like Remove Destroyer.