Badge
vig-badge
import { Badge } from '@vigdx/ui/badge';Variants
variant picks a soft tone: secondary (default), primary , accent , ghost and the four status colors. Pick the tone by meaning, not decoration.
Status dot
dot prefixes the label with a small dot in the badge color, a common pattern for service or record status.
Borderless
bordered to false for flat badges on busy surfaces such as dense tables.
Projected content
label the badge renders its projected content, so it can hold inline markup. Badges sit inline with headings and text.
Usage reports Beta
Invoice INV-2041
Styling hooks
Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="badge"][data-part="root"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.
Scope: [data-scope="badge"]
| Part | Element | data-state |
|---|---|---|
root | — | |
dot | dot ). | — |
Accessibility
- A badge is plain inline text with no role: screen readers read it as part of the surrounding content, so place it where that reading order makes sense.
- The status dot is decorative (
aria-hidden); the label must carry the meaning on its own, never the color alone. - If a badge changes while the user is on the page and the change matters, announce it through a live region (for example a toast or
role="status"text). - Every tone meets WCAG AA text contrast on its tinted fill in light and dark mode.
API
Badge
vig-badge| Name | Type | Default | Description |
|---|---|---|---|
bordered | boolean | true | Draws the tinted outline; turn it off for flat chips on busy surfaces. |
dot | boolean | false | Renders a small status dot in the current variant color. |
label | string | undefined | undefined | — |
variant | BadgeVariant | 'secondary' | — |