Badge
Label status or metadata beside related content.
Anatomy#
Usage#
Use Badge for compact status or metadata beside content. It renders a presentational span by default.
For an action, render a semantic interactive element with an accessible name.
Presentational status#
Place Badge beside a separately labeled control or heading. It does not replace an accessible status
announcement where one is required. variant (solid, soft by default, subtle, outline),
tone, and size (sm, md by default, lg) change appearance only.
Label and icons#
Badge text always comes from children. leading and trailing take icon names and render
before and after the label. A badge with no children and exactly one icon renders as a square
icon badge.
Interactive root#
For a clickable badge, set as to a semantic element and pass the attributes that element requires.
Examples#
Status#
Pair badges with surrounding text to indicate status or category.
With icons#
Add leading or trailing icons to reinforce the badge label.
Interactive#
Render Badge with as="button" for clickable filter chips. Keep type="button", and set
aria-pressed so the active filter is announced as well as styled.
API Reference#
Props#
Props for the Badge component. Renders a <span> element by default.