Badge
A short static label, a state or a count, in a 24 px pill with caps. Never a button, and never more than three words.
import { Badge } from '@fairgarden/design/feedback/badge'
Badges keep caps: author the label in sentence case and type-label sets the caps. Every fill has an edge, so a badge keeps its shape in print, where fills drop and edges and words print black. Use one badge per item, two at most.
Outline, pill, static fill, sticker, status and count
Outline, pill, static fill, sticker, status and count
With no variant the badge is the outline form. variant="solid" is the pill: a step-9 fill with its edge and a contrast-ink label. variant="static" is the static fill: a step-4 fill of the secondary with its step-11 edge and a --primary12 label, which a solid pill on pink, red, crimson, gold, ruby or tomato takes too. variant="sticker" is a nested light face with a ring and bold caps, the same on every ground; use one per module. status draws the status glyph plus the word on the status fill. numeric sets a count in the data face.
Primary and secondary
Primary and secondary
secondary is the pill's accent or taxonomy scale; on crimson, gold, pink, red, ruby and tomato, which carry no text on step 9, the pill takes the static fill instead. status sets secondary to its status scale (info indigo, success green, warning amber, danger red) unless you pass one. primary inks the outline, sticker and count.
On grounds
On paper and forest
Saturated grounds take no accent fills: use the outline badge there.
paper
forest
API Reference
Badge
A static label in caps (type-label, authored in sentence case; badges
keep caps [D160]), 24 px tall, --radius-round. Use one badge per item,
two at most. On saturated grounds use the outline badge: they take no
accent fills. Fills drop in print; edges and words print black.
| Prop | Type | Description |
|---|---|---|
numeric | | |
primary | | Primary Radix scale: the outline, sticker and count inks. Never defaulted; omitted, it inherits the scope [D133]. |
secondary | | Secondary Radix scale: the solid pill’s fill (the accent or taxonomy
scale). With |
status | | |
statusLabel | | The status glyph’s accessible name; defaults to the English status word. |
variant | | Omitted: the outline badge ( |
StatusGlyph
| Prop | Type | Description |
|---|---|---|
label | | Accessible name, normally the status word. Omit it, or pass |
status | |
Additional types
BadgeProps
Props for Badge: span props, render, the kind (variant, status or numeric) and the color axes.
type BadgeProps =
| (React.ClassAttributes<HTMLSpanElement> &
React.HTMLAttributes<HTMLSpanElement> &
__type & { variant?: 'solid' | 'static' | 'sticker'; status?: undefined; numeric?: false } & {
primary?:
| 'ruby'
| 'olive'
| 'sage'
| 'slate'
| 'sand'
| 'gray'
| 'mauve'
| 'brown'
| 'bronze'
| 'gold'
| 'red'
| 'crimson'
| 'tomato'
| 'pink'
| 'plum'
| 'indigo'
| 'iris'
| 'violet'
| 'purple'
| null;
secondary?:
| 'ruby'
| 'olive'
| 'sage'
| 'slate'
| 'sand'
| 'gray'
| 'mauve'
| 'brown'
| 'bronze'
| 'gold'
| 'red'
| 'crimson'
| 'tomato'
| 'pink'
| 'plum'
| 'indigo'
| 'iris'
| 'violet'
| 'purple'
| 'amber'
| 'blue'
| 'cyan'
| 'grass'
| 'green'
| 'jade'
| 'lime'
| 'mint'
| 'orange'
| 'sky'
| 'teal'
| 'yellow'
| null;
statusLabel?: string;
})
| (React.ClassAttributes<HTMLSpanElement> &
React.HTMLAttributes<HTMLSpanElement> &
__type & { variant?: undefined; status: BadgeStatus; numeric?: false } & {
primary?:
| 'ruby'
| 'olive'
| 'sage'
| 'slate'
| 'sand'
| 'gray'
| 'mauve'
| 'brown'
| 'bronze'
| 'gold'
| 'red'
| 'crimson'
| 'tomato'
| 'pink'
| 'plum'
| 'indigo'
| 'iris'
| 'violet'
| 'purple'
| null;
secondary?:
| 'ruby'
| 'olive'
| 'sage'
| 'slate'
| 'sand'
| 'gray'
| 'mauve'
| 'brown'
| 'bronze'
| 'gold'
| 'red'
| 'crimson'
| 'tomato'
| 'pink'
| 'plum'
| 'indigo'
| 'iris'
| 'violet'
| 'purple'
| 'amber'
| 'blue'
| 'cyan'
| 'grass'
| 'green'
| 'jade'
| 'lime'
| 'mint'
| 'orange'
| 'sky'
| 'teal'
| 'yellow'
| null;
statusLabel?: string;
})
| (React.ClassAttributes<HTMLSpanElement> &
React.HTMLAttributes<HTMLSpanElement> &
__type & { variant?: undefined; status?: undefined; numeric: true } & {
primary?:
| 'ruby'
| 'olive'
| 'sage'
| 'slate'
| 'sand'
| 'gray'
| 'mauve'
| 'brown'
| 'bronze'
| 'gold'
| 'red'
| 'crimson'
| 'tomato'
| 'pink'
| 'plum'
| 'indigo'
| 'iris'
| 'violet'
| 'purple'
| null;
secondary?:
| 'ruby'
| 'olive'
| 'sage'
| 'slate'
| 'sand'
| 'gray'
| 'mauve'
| 'brown'
| 'bronze'
| 'gold'
| 'red'
| 'crimson'
| 'tomato'
| 'pink'
| 'plum'
| 'indigo'
| 'iris'
| 'violet'
| 'purple'
| 'amber'
| 'blue'
| 'cyan'
| 'grass'
| 'green'
| 'jade'
| 'lime'
| 'mint'
| 'orange'
| 'sky'
| 'teal'
| 'yellow'
| null;
statusLabel?: string;
})BadgeStatus
type BadgeStatus = 'info' | 'success' | 'warning' | 'danger'StatusGlyphProps
type StatusGlyphProps = anystatusScales
type statusScales = { info: 'indigo'; success: 'green'; warning: 'amber'; danger: 'red' }statusWords
The glyph’s accessible name: the status in words, so it is never shape or color alone.
type statusWords = Record<'info' | 'success' | 'warning' | 'danger', string>Specification: DESIGN-SYSTEM.md §10.11 (badge, tag and chip) and §1.5.4 (status).