chrome

<tc-badge>

Compact label with five variant colors and an optional pill shape. Pure presentation.

import "@ra9/tan-compose-kit/badge"

Props

NameTypeDefaultDescription
variant"neutral" | "info" | "success" | "warning" | "danger""neutral"Visual color preset.
size"sm" | "md""md"Padding + font scale.
pillbooleanfalseRender with fully-rounded ends.

Slots

SlotDescription
(default)Badge content. Usually a short word or count.

CSS variables

VariableDefaultDescription
--tc-badge-radiusvar(--tc-radius-sm, 6px)Corner radius (ignored when `pill` is true).
--tc-badge-fontvar(--tc-font-sans, …)Font family.
--tc-badge-neutral-bgvar(--tc-color-rule, #ece5d3)Neutral background.
--tc-badge-neutral-fgvar(--tc-color-ink, #14171f)Neutral foreground.
--tc-badge-info-bgvar(--tc-color-info-bg, #dde6f4)Info background.
--tc-badge-info-fgvar(--tc-color-info-fg, #1f3a66)Info foreground.
--tc-badge-success-bgvar(--tc-color-success-bg, #dbece2)Success background.
--tc-badge-success-fgvar(--tc-color-success-fg, #155b40)Success foreground.
--tc-badge-warning-bgvar(--tc-color-warning-bg, #f5e7cf)Warning background.
--tc-badge-warning-fgvar(--tc-color-warning-fg, #7a4f0a)Warning foreground.
--tc-badge-danger-bgvar(--tc-color-danger-bg, #f4dad7)Danger background.
--tc-badge-danger-fgvar(--tc-color-danger-fg, #7a1a14)Danger foreground.

Examples

Variants

Neutral Info Success Warning Danger
<tc-badge>Neutral</tc-badge> <tc-badge variant="success">Live</tc-badge> <tc-badge variant="warning">Beta</tc-badge> <tc-badge variant="danger">Deprecated</tc-badge>

Sizes

Small Medium
<tc-badge size="sm" variant="info">12</tc-badge>

Pill

Active Pending 3
<tc-badge pill variant="success">Active</tc-badge> <tc-badge pill variant="danger" size="sm">3</tc-badge>

Inside other components

Badges combine well with cards, table cells, and nav items.

<tc-card title="Notifications"> You have <tc-badge pill variant="danger" size="sm">3</tc-badge> unread messages. </tc-card>

Theming

<tc-badge style="--tc-badge-info-bg: #e3f2fd; --tc-badge-info-fg: #0d47a1;" variant="info" >Custom blue</tc-badge>

Accessibility

  • The badge is purely visual — it doesn't carry semantic meaning by itself. If the badge is the only signal of a state (e.g. "unread"), add an aria-label or surrounding text so screen readers get the message.
  • Contrast is tuned to pass AA on the default surface for every variant. When overriding the tokens, re-check contrast.