VERIFICATION-0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF
- F#
- Zero runtime
- Stable
- Preview
- Changelog
<forma-badge>
Compact labels and metadata; status badges carry meaning in text with a redundant colored edge.
<forma-badge>patterns/badge.htmlBadges are small mono-face labels for metadata on public pages: language, version, runtime, release status or topic. A badge is a span (or an a when it links somewhere) inside an unstyled ul.forma-badge-list, which wraps. data-forma-status adds a thicker inline-start edge in a status color; the badge text always states the status, so the edge is a redundant cue. The brand-neutral defaults make every status edge the primary text color; a theme or brand may give statuses distinct hues.
ul, so the count is announced.The smallest correct markup: the canonical pattern from patterns/badge.html inside its public tag. Copy this first, then adapt labels, names and state.
Rendered from the canonical pattern file.
Static specimen. Its links point to placeholder destinations that do not exist on this site. Its controls are shown for their markup and appearance and cannot be operated here.
<forma-badge class="forma-component-tag">
<div class="forma-site">
<ul class="forma-badge-list" aria-label="Product facts">
<li><span class="forma-badge">F#</span></li>
<li><span class="forma-badge">Zero runtime</span></li>
<li><span class="forma-badge" data-forma-status="success">Stable</span></li>
<li><span class="forma-badge" data-forma-status="warning">Preview</span></li>
<li><a class="forma-badge" href="#changelog">Changelog</a></li>
</ul>
</div>
</forma-badge>
Click or tap the code once to select all of it, then copy.
A product's release facts: a success status plus plain metadata badges, next to the hero actions.
<forma-badge class="forma-component-tag">
<div class="forma-site">
<ul class="forma-badge-list" aria-label="Release facts">
<li><span class="forma-badge" data-forma-status="success">Stable</span></li>
<li><span class="forma-badge">Version 1.4.0</span></li>
<li><span class="forma-badge">.NET 8</span></li>
<li><span class="forma-badge">MIT licence</span></li>
</ul>
</div>
</forma-badge>
Click or tap the code once to select all of it, then copy.
All four status values on a component inventory. Each badge's text states the status; the edge color repeats it and depends on the theme.
<forma-badge class="forma-component-tag">
<div class="forma-site">
<ul class="forma-badge-list" aria-label="Pattern lifecycle">
<li><span class="forma-badge" data-forma-status="success">Stable: Site header</span></li>
<li><span class="forma-badge" data-forma-status="info">New: Callout</span></li>
<li><span class="forma-badge" data-forma-status="warning">Preview: Media hero</span></li>
<li><span class="forma-badge" data-forma-status="danger">Deprecated: Landing layout</span></li>
</ul>
</div>
</forma-badge>
Click or tap the code once to select all of it, then copy.
Each mobile example renders in its own document inside a real narrow viewport, so Forma's media and container queries run exactly as they would on a phone. Choose a width to compare.
Linked topic badges under an article at phone width. The list wraps onto several lines.
Live demo. 5 native actions work here and are verified by an outcome test.
<forma-badge class="forma-component-tag">
<div class="forma-site">
<ul class="forma-badge-list" aria-label="Topics">
<li><a class="forma-badge" href="#badge-mobile-topic-links-end">Accessibility</a></li>
<li><a class="forma-badge" href="#badge-mobile-topic-links-end">Design tokens</a></li>
<li><a class="forma-badge" href="#badge-mobile-topic-links-end">Forced colors</a></li>
<li><a class="forma-badge" href="#badge-mobile-topic-links-end">Release engineering</a></li>
<li id="badge-mobile-topic-links-end"><a class="forma-badge" href="#badge-mobile-topic-links-end">Typography</a></li>
</ul>
</div>
</forma-badge>
Click or tap the code once to select all of it, then copy.
The canonical pattern in a true 320px viewport, the minimum width every Forma component must support without page-level horizontal scrolling.
Static specimen. Its links point to placeholder destinations that do not exist on this site. Its controls are shown for their markup and appearance and cannot be operated here.
Forma components have no JavaScript API. Their public contract is the markup: native elements and attributes you write, and the CSS hooks below. The CSS hook table is generated from the built stylesheet, so it always matches the shipped implementation.
| Attribute | On | Values | Default | Description |
|---|---|---|---|---|
aria-label | ul.forma-badge-list | string | — | Names the list ("Release facts", "Topics"). |
href | a.forma-badge | URL | — | Makes a badge a link. Use an a, never a clickable span. |
| Hook | Kind | Values or default | Description |
|---|---|---|---|
.forma-badge | Block class | — | The badge: bordered mono label on the surrounding tone. On an a it gets a 24px minimum height and a stronger border on hover. |
[data-forma-status] | Attribute hook | "danger", "info", "success", "warning" | success, warning, danger or info. Thickens the inline-start edge and colors it with --forma-color-status-*. The text must state the same status. |
.forma-badge-list | Block class | — | Unstyled ul that wraps its badges with a small gap and vertical margin. |
| Keys | Result |
|---|---|
| Tab / Shift+Tab | Moves between linked badges; span badges are not focusable. |
| Enter | Follows a linked badge (native link behavior). |
| State | How it is expressed | Presentation |
|---|---|---|
| Plain | span.forma-badge | Neutral bordered label. |
| Status | data-forma-status | Accent-width inline-start edge in the status color; text states the status. |
| Link hover | a.forma-badge:hover | The border strengthens to the tone's strong rule. |
| Focus | :focus-visible on a.forma-badge | The shell's outline and halo. |
data-forma-status.a for badges that navigate; do not make spans interactive with script.Generated fault-injection specimens expose content, spacing, color-cue, and reduced-effective-contrast risks. They screen presentation robustness as engineering screens without claiming human-subject validation.