A small status marker: a soft or flat pill with a label and optional icons.
Options
| Choice | Values | Default | What it does |
|---|---|---|---|
looksmbk-badge--look-<value> | softflat | soft | Soft, the default, is the subtle surface inside an edge of the tone's color; flat is the tone's full surface. The default tone looks the same in soft and flat. |
tonesmbk-badge--tone-<value> | defaultsuccessinfowarningdanger | default | A see-through gray that shows on every surface, or one of the four feedback families. |
sizesmbk-badge--size-<value> | lgmdsm | lg | The pill scale shared with the chip and the tag: 32, 24 and 20 tall. |
Examples
Usage
A soft badge with an icon: the default look, the tone color on its subtle surface inside an edge.
Tones
The tone is the meaning: a neutral gray that shows on any surface, or one of the four feedback colors.
Flat
The flat look fills the badge with the tone color, for a status that should stand out.
Sizes
Three heights, on the same scale as the chip and the tag.
With icons
An icon at either end, or both.
Counts
A count in the small size; its digits are all one width, so a number that changes keeps its place.
Guidelines
Purpose
A small, inert marker that states a status or a count beside the thing it describes: published, three unread, warning. It is not pressed and not removed, which is what separates it from a chip and a tag.
When to use
- A status word on a row, a card or a heading.
- A count on a navigation item.
When not to use
- For something a person can press or dismiss. Use a chip or a tag.
- For a category that is not a state. Use a tag.
- For a dot that marks a status beside a name. Use the status dot.
- As the only carrier of meaning by color. Give it a text or shape cue as well (WCAG 1.4.1 Use of Color).
Usage rules
Do
- Keep the label to a word or a number.
- Use the soft look, the default, for status almost everywhere; it stays quiet in dense lists. Use the flat look when the status should stand out.
Don't
- Put a badge inside a button. The button's own label is the place for its state.
- Rely on the tone's color alone; say the status in words.
Keep the label to a word or a number, so the badge reads at a glance.
A sentence in a badge stretches it and stops it reading as a status.
Put a count in the button's own label, so the button reads as one control.
A badge inside a button competes with the label and looks like a second control.
Anatomy
- The block, a pill that fixes its height by size, on the same scale as the chip and the tag. The default tone is a see-through gray with no edge, so it shows on any surface. A soft feedback badge draws a thin edge in its tone's own border color; a flat badge has none.
- The label part, the text, in the label style. Numbers take equal-width digits, so a count that changes does not shift what is beside it.
- The icon part, before or after the label. Optional.
Behavior
None. It renders and stays put.
Accessibility
What it does for you
- A labeled badge is read as its text.
- The text of both looks on its surface, soft and flat, is measured on the color foundation's Contrast section, in both themes. A pair that falls short there is corrected in Figma, not here.
What you must do
- Say the status in the badge's words, or beside it with an icon, so it never rests on color alone.
How to test
- With a screen reader, the badge is read as its text.
- Tab past it: a badge takes no focus.
Source
The files the badge is made of. Its folder on GitHub (opens in a new tab) holds them with its wrapper and its document.
Stylesheet
/* smbk-badge — Badge. Figma "Badge" 4126:20020.
* One pill scale with the chip and the tag: heights on the mark sizes, Label MD
* at lg and Label SM below it, padding and gap one step per size.
* Soft is the default look, so a badge with no look class draws soft; flat
* and the dot draw the tone's full surface. The default tone has one look, a
* see-through gray with no edge, so it shows on every surface.
* Every badge has an edge, clear unless its look draws one (the soft badges of
* the four feedback tones). Figma draws the edge inside the badge, so each
* padding gives the edge's width back and a badge with an edge is the same
* size as one without.
* Counts take equal-width digits, so a number that changes does not move its
* neighbors. */
.smbk-badge {
/* The default tone; each feedback tone's soft look sets these again below (the tone recipe). */
--smbk-tone-surface: var(--smbk-color-surface-neutral-subtle);
--smbk-tone-border: transparent;
--smbk-tone-text: var(--smbk-color-text-default);
box-sizing: border-box;
display: inline-flex;
align-items: center;
gap: var(--smbk-space-inline-sm);
height: var(--smbk-size-mark-xl);
padding: 0 calc(var(--smbk-space-inset-lg) - var(--smbk-border-width-hairline));
border: var(--smbk-border-width-hairline) solid var(--smbk-tone-border);
border-radius: var(--smbk-radius-full);
background: var(--smbk-tone-surface);
color: var(--smbk-tone-text);
font-family: var(--smbk-typography-label-md-font-family);
font-size: var(--smbk-typography-label-md-font-size);
font-weight: var(--smbk-typography-label-md-font-weight);
line-height: var(--smbk-typography-label-md-line-height);
letter-spacing: var(--smbk-typography-label-md-letter-spacing);
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
.smbk-badge__icon {
font-size: var(--smbk-size-icon-sm);
}
/* ---- size ---- */
.smbk-badge--size-md,
.smbk-badge--size-sm {
gap: var(--smbk-space-inline-xs);
font-family: var(--smbk-typography-label-sm-font-family);
font-size: var(--smbk-typography-label-sm-font-size);
font-weight: var(--smbk-typography-label-sm-font-weight);
line-height: var(--smbk-typography-label-sm-line-height);
letter-spacing: var(--smbk-typography-label-sm-letter-spacing);
}
.smbk-badge--size-md {
height: var(--smbk-size-mark-lg);
padding: 0 calc(var(--smbk-space-inset-md) - var(--smbk-border-width-hairline));
}
.smbk-badge--size-sm {
height: var(--smbk-size-mark-md);
padding: 0 calc(var(--smbk-space-inset-sm) - var(--smbk-border-width-hairline));
}
:is(.smbk-badge--size-md, .smbk-badge--size-sm) .smbk-badge__icon {
font-size: var(--smbk-size-icon-xs);
}
/* The default tone is the block's own look above. */
/* ---- soft, the default: the tone recipe, the tone's subtle surface inside its pale edge ---- */
.smbk-badge--tone-success { --smbk-tone-surface: var(--smbk-color-feedback-success-surface-subtle); --smbk-tone-border: var(--smbk-color-feedback-success-border-subtle); --smbk-tone-text: var(--smbk-color-feedback-success-text-on-subtle); }
.smbk-badge--tone-info { --smbk-tone-surface: var(--smbk-color-feedback-info-surface-subtle); --smbk-tone-border: var(--smbk-color-feedback-info-border-subtle); --smbk-tone-text: var(--smbk-color-feedback-info-text-on-subtle); }
.smbk-badge--tone-warning { --smbk-tone-surface: var(--smbk-color-feedback-warning-surface-subtle); --smbk-tone-border: var(--smbk-color-feedback-warning-border-subtle); --smbk-tone-text: var(--smbk-color-feedback-warning-text-on-subtle); }
.smbk-badge--tone-danger { --smbk-tone-surface: var(--smbk-color-feedback-danger-surface-subtle); --smbk-tone-border: var(--smbk-color-feedback-danger-border-subtle); --smbk-tone-text: var(--smbk-color-feedback-danger-text-on-subtle); }
/* ---- flat and dot: the tone's full surface, with no edge ---- */
.smbk-badge--look-flat.smbk-badge--tone-success {
border-color: transparent;
background: var(--smbk-color-feedback-success-surface);
color: var(--smbk-color-feedback-success-text-on-surface);
}
.smbk-badge--look-flat.smbk-badge--tone-info {
border-color: transparent;
background: var(--smbk-color-feedback-info-surface);
color: var(--smbk-color-feedback-info-text-on-surface);
}
.smbk-badge--look-flat.smbk-badge--tone-warning {
border-color: transparent;
background: var(--smbk-color-feedback-warning-surface);
color: var(--smbk-color-feedback-warning-text-on-surface);
}
.smbk-badge--look-flat.smbk-badge--tone-danger {
border-color: transparent;
background: var(--smbk-color-feedback-danger-surface);
color: var(--smbk-color-feedback-danger-text-on-surface);
}
/* ---- dot: a bare mark, no label. Its words, if markup gives it any, stay hidden over the
tone's text color above. ---- */
/* ---- high contrast (forced colors) ---- */
/* In Windows high-contrast mode the browser drops fills and shadows; this puts the meaning back with the
user's own colors. Nothing here applies outside that mode. */
@media (forced-colors: active) {
/* The dot is a fill and nothing else, so it would vanish. It takes the palette's text color. */
}Tokens it reads
| Token and CSS | Value | Preview | Foundation |
|---|---|---|---|
| color.surface.neutral-subtle--smbk-color-surface-neutral-subtle | light: #373d431adark: #606a7533changes with theme | Color | |
| color.text.default--smbk-color-text-default | light: #232527dark: #e7ebf0changes with theme | Color | |
| space.inline.sm--smbk-space-inline-sm | comfortable: 6pxcompact: 4pxchanges with density | Spacing | |
| size.mark.xl--smbk-size-mark-xl | 32px | Size | |
| space.inset.lg--smbk-space-inset-lg | comfortable: 12pxcompact: 8pxchanges with density | Spacing | |
| border-width.hairline--smbk-border-width-hairline | 1px | Border width | |
| radius.full--smbk-radius-full | 9999px | Radius | |
| typography.label-md--smbk-typography-label-md-font-family--smbk-typography-label-md-font-size--smbk-typography-label-md-font-weight--smbk-typography-label-md-line-height--smbk-typography-label-md-letter-spacing--smbk-typography-label-md-text-transform | fontFamily: Geist, Geist Fallback, system-ui, sans-seriffontSize: 14pxfontWeight: 500lineHeight: 1.4letterSpacing: 0px | The quick brown fox | Typography |
| size.icon.sm--smbk-size-icon-sm | 16px | Size | |
| space.inline.xs--smbk-space-inline-xs | 4px | Spacing | |
| typography.label-sm--smbk-typography-label-sm-font-family--smbk-typography-label-sm-font-size--smbk-typography-label-sm-font-weight--smbk-typography-label-sm-line-height--smbk-typography-label-sm-letter-spacing--smbk-typography-label-sm-text-transform | fontFamily: Geist, Geist Fallback, system-ui, sans-seriffontSize: 12pxfontWeight: 500lineHeight: 1.4letterSpacing: 0px | The quick brown fox | Typography |
| size.mark.lg--smbk-size-mark-lg | 24px | Size | |
| space.inset.md--smbk-space-inset-md | comfortable: 8pxcompact: 6pxchanges with density | Spacing | |
| size.mark.md--smbk-size-mark-md | 20px | Size | |
| space.inset.sm--smbk-space-inset-sm | comfortable: 6pxcompact: 4pxchanges with density | Spacing | |
| size.icon.xs--smbk-size-icon-xs | 12px | Size | |
| color.feedback.success.surface-subtle--smbk-color-feedback-success-surface-subtle | light: #dffddfdark: #0a2d0echanges with theme | Color | |
| color.feedback.success.border-subtle--smbk-color-feedback-success-border-subtle | light: #8ddf90dark: #084712changes with theme | Color | |
| color.feedback.success.text-on-subtle--smbk-color-feedback-success-text-on-subtle | light: #016317dark: #8ddf90changes with theme | Color | |
| color.feedback.info.surface-subtle--smbk-color-feedback-info-surface-subtle | light: #e3ebfedark: #162352changes with theme | Color | |
| color.feedback.info.border-subtle--smbk-color-feedback-info-border-subtle | light: #b8ccffdark: #213583changes with theme | Color | |
| color.feedback.info.text-on-subtle--smbk-color-feedback-info-text-on-subtle | light: #2f4ab8dark: #b8ccffchanges with theme | Color | |
| color.feedback.warning.surface-subtle--smbk-color-feedback-warning-surface-subtle | light: #ffe6dbdark: #431b07changes with theme | Color | |
| color.feedback.warning.border-subtle--smbk-color-feedback-warning-border-subtle | light: #febea2dark: #692903changes with theme | Color | |
| color.feedback.warning.text-on-subtle--smbk-color-feedback-warning-text-on-subtle | light: #913900dark: #febea2changes with theme | Color | |
| color.feedback.danger.surface-subtle--smbk-color-feedback-danger-surface-subtle | light: #fee5e1dark: #4b130echanges with theme | Color | |
| color.feedback.danger.border-subtle--smbk-color-feedback-danger-border-subtle | light: #febdb2dark: #761812changes with theme | Color | |
| color.feedback.danger.text-on-subtle--smbk-color-feedback-danger-text-on-subtle | light: #a51d17dark: #febdb2changes with theme | Color | |
| color.feedback.success.surface--smbk-color-feedback-success-surface | #037a1f | Color | |
| color.feedback.success.text-on-surface--smbk-color-feedback-success-text-on-surface | #f9fafb | Color | |
| color.feedback.info.surface--smbk-color-feedback-info-surface | #3b5ce3 | Color | |
| color.feedback.info.text-on-surface--smbk-color-feedback-info-text-on-surface | #f9fafb | Color | |
| color.feedback.warning.surface--smbk-color-feedback-warning-surface | #b14904 | Color | |
| color.feedback.warning.text-on-surface--smbk-color-feedback-warning-text-on-surface | #f9fafb | Color | |
| color.feedback.danger.surface--smbk-color-feedback-danger-surface | #cc0d0d | Color | |
| color.feedback.danger.text-on-surface--smbk-color-feedback-danger-text-on-surface | #f9fafb | Color |
Manifest
{
"name": "badge",
"block": "smbk-badge",
"summary": "A small status marker: a soft or flat pill with a label and optional icons.",
"adapt": "css",
"axes": {
"look": {
"values": [
"soft",
"flat"
],
"default": "soft",
"description": "Soft, the default, is the subtle surface inside an edge of the tone's color; flat is the tone's full surface. The default tone looks the same in soft and flat."
},
"tone": {
"values": [
"default",
"success",
"info",
"warning",
"danger"
],
"default": "default",
"description": "A see-through gray that shows on every surface, or one of the four feedback families."
},
"size": {
"values": [
"lg",
"md",
"sm"
],
"default": "lg",
"description": "The pill scale shared with the chip and the tag: 32, 24 and 20 tall."
}
},
"flags": {},
"parts": [
"icon",
"label"
],
"figmaNodeId": "4126:20020"
}