Molecule · stable · v1.2.0 · owner: Site system lead · contract 19 of 20 points (open: figma)
Do and don't
Do: A record read at build time
Rendered by figure-frame.tsOpen example: Figure with caption · Do: A record read at build time Use the full-page example to follow page links.
Do: A screenshot
Rendered by figure-frame.tsOpen example: Figure with caption · Do: A screenshot Use the full-page example to follow page links.
Do: Native labelled diagram
Rendered by figure-frame.tsOpen example: Figure with caption · Do: Native labelled diagram Use the full-page example to follow page links.
Do: Native-owned evidence root
Rendered by figure-frame.tsOpen example: Figure with caption · Do: Native-owned evidence root Use the full-page example to follow page links.
Don't: No caption
Rendered by figure-frame.tsOpen example: Figure with caption · Don't: No caption Use the full-page example to follow page links.
Don't: A self-playing element in a figure frame
Rendered by figure-frame.tsOpen example: Figure with caption · Don't: A self-playing element in a figure frame Use the full-page example to follow page links.
Rules
| Rule | Why | Check |
|---|---|---|
| Native form preserves actual labels, source caption and visual binding without playback or an added head. | Reuse must retain the real figure and enhancement selector. | Automated: tests/unit/frame-api-compatibility.test.ts |
| Every figure has a caption with its data source. | Evidence must be checkable. | Automated: scripts/site/system/check-pages.ts (figure without figcaption) |
| Figures do not play; showcases do. | One frame for evidence, one for experiences: the reader learns what each means. | Automated: scripts/site/system/check-pages.ts (data-pl-controls only inside a showcase frame) |
API
| Prop | Type | Required | Default | What it does |
|---|---|---|---|---|
className | string | No | Native variant only: exact existing root class list without a visual prefix; nonempty class tokens, mutually exclusive with kind. | |
variant | framed | native | No | "framed" | Existing head/box or native captioned figure without extra chrome. |
id | string | No | Caller-owned root ID. | |
lang | en | ja | No | Explicit source language. | |
labelledBy | string | No | Actual body/caption label IDs; dangling references refused. | |
visual | object | No | Existing {name,variant} data-visual binding, not data-demo. | |
captionOptions | object | No | Caption kind/label/claim/state and native id/lang/extraClass; tag stays figcaption. | |
title | string | No | Required framed title; native form retains its body label. | |
tag | string | No | Provenance: Sample data, Recorded server output, a version. | |
body | html | Yes | The figure markup (an organism or an image). | |
caption | html | Yes | What it shows and where the data comes from. | |
kind | string | No | The figure organism's class added after visual (contract-x, screen-shot); exclusive with native className. |
Contract details
The full contract: identity, anatomy, variants, states, tokens, layout, motion, accessibility, content, tests
Identity
| Aspect | Value |
|---|---|
| Id | figure-frame |
| Layer | Molecules |
| Category | media |
| Owner | Site system lead |
| Status | stable |
| Version | 1.2.0 |
| Source | apps/showcase/site/system/molecules/figure-frame.ts (private repository; the contract and the render function are this one module) |
| Version | Date | Change |
|---|---|---|
| 1.2.0 | 2026-10-29 | Add explicit native-owned root classes without adding visual; default and kind-based frames unchanged. |
| 1.1.0 | 2026-10-29 | Add native captioned figure and typed root metadata; default output unchanged. |
| 1.0.0 | 2026-10-26 | Every diagram and screenshot sits in one frame: a head with title and provenance tag, the figure, and its caption. |
Use when
- A diagram or real artefact supports a claim. Why: One frame makes every figure recognisable as evidence.
- A screenshot of the product. Why: The frame states it is a real screen with sample records.
Do not use when
- For something that plays or reacts. Why: Self-playing elements sit in the ShowcaseFrame, with playback controls.
- Without a caption. Why: Every figure says what it shows and where its data comes from (D-SITE-007).
Anatomy
| Part | What it is |
|---|---|
| root | figure.visual (+ kind) by default; native className owns the exact existing root classes |
| frame | div.visual-frame |
| head | Framed only: div.visual-head with h3 and Tag; native body retains its own label |
| body | The figure itself |
| caption | figcaption |
Made of: heading, tag, caption, tokens:colour.
Used in: cloth-diagram, conformance-table, contract-excerpt, coverage-map, decision-list, design-md-excerpt, drift-palette, flow-diagram, flow-layers, product-screen, repo-tree, system-of-systems, takenote-card, token-chain, job-section.
Variants
| Variant | When | Why |
|---|---|---|
| native captioned | An existing diagram/card has its own body label and layout. | Retains its source caption without another box or a new root class when className is explicit. |
| diagram | A diagram drawn from data. | Same head and caption as every figure. |
| screenshot | A product screen. | Tagged 'Real screen, sample records'. |
States
| State | Rendered or not applicable |
|---|---|
| default | default |
| hover | Not applicable: A figure is not interactive, so it has no hover state. |
| focus-visible | Not applicable: A figure does not take focus; links and buttons inside it carry their own focus ring. |
| active | Not applicable: A figure cannot be pressed. |
| disabled | Not applicable: A figure has nothing to disable. |
| loading | Not applicable: A figure is rendered at build time and is complete when the page loads. |
| empty | Not applicable: A figure is not rendered without content; the builder skips it. |
| error | Not applicable: A figure shows no data that can fail. |
| current | Not applicable: A figure has no current item. |
| visited | Not applicable: A figure is not a link. |
| expanded | Not applicable: A figure does not open or close. |
Tokens
| Part | Token |
|---|---|
| frame.background | --surface |
| frame.border-top | --rule-frame --ink |
| head.font | --type-strong |
| caption.font | --type-small |
| --figure-frame-background-surface | var(--surface) |
| --figure-frame-border-top-rule-frame | var(--rule-frame) |
| --figure-frame-border-top-ink | var(--ink) |
| --figure-frame-padding-space-8 | var(--space-8) |
| --figure-frame-padding-space-6 | var(--space-6) |
| --figure-frame-margin-top-space-5 | var(--space-5) |
| --figure-frame-font-type-small | var(--type-small) |
| --figure-frame-color-ink-2 | var(--ink-2) |
| --figure-frame-gap-space-4 | var(--space-4) |
| --figure-frame-gap-space-7 | var(--space-7) |
| --figure-frame-margin-bottom-space-6 | var(--space-6) |
| --figure-frame-font-type-h3 | var(--type-h3) |
| --figure-frame-font-size-fs-body | var(--fs-body) |
| --figure-frame-border-rule-hair | var(--rule-hair) |
| --figure-frame-border-line | var(--line) |
| --figure-frame-background-cotton | var(--cotton) |
Layout
| Aspect | Value |
|---|---|
| breakpoints | Required review at 390, 768, 1024 and 1440 px; execution is not implied by this declaration; full column width; wide figures break out of prose to the page width. |
| wrapping | Head wraps under 600 px: tag below title. |
| textExpansion | Japanese captions wrap. |
Spacing and rhythm
| Aspect | Value |
|---|---|
| internal | --space-7 frame padding; --space-5 under the head. |
| external | --space-9 above and below in prose. |
| rhythm | Inside a section, after the text it supports. |
Motion
| Aspect | Value |
|---|---|
| None | Static figures do not move; moving ones are showcases. |
Runtime and reuse
Render-only element; mount any registered child enhancements separately. Preserve required Site CSS, fonts, responsive and locale rules from nativeElement.
Accessibility passport
| Aspect | Value |
|---|---|
| role | figure, named by its figcaption |
| name | The caption |
| keyboard | Interactive parts inside are focusable. |
| focus | In reading order. |
| screenReader | Reads the title, the figure's text alternative and the caption. |
| contrast | Ink on surface 14:1. |
| target | Not a target. |
Content
| Slot | Length | Voice |
|---|---|---|
| title | 8 words | What it is |
| caption | 2 sentences | What it shows and where the data comes from |
Good: “One contract: Button · Loom Base 1.0.0, MIT · Read from packages/base/contracts when this page is built.”
Bad: “Figure 1”
Japanese: Captions are translated with the page; the screen itself is English UI and the caption says so.
Icons and illustrations
None: this element uses no icon or illustration of its own.
Decisions and exceptions
- D-SITE-007: One caption, with an honesty variant
- D-SITE-008: One ShowcaseFrame for every self-playing element
Usage
79 uses across the built pages (measured by npm run site:system).
Tests
| Aspect | Value |
|---|---|
| unit | tests/unit/site-system.test.ts: renders every do and don't example through the registry and checks the classes it owns |
| visual | Not yet: there are no screenshot baselines; the Library page is checked for sideways scroll at 1440 px by tests/site/system.spec.ts |
| a11y | tests/site/system.spec.ts: axe (0 serious or critical) on the element's Library page in light and dark |
| parity | scripts/site/system/check.ts: Library examples are rendered by the same render function the site imports |
Figma
not-yet: The Loom Site Figma library is the last stage of the plan; this element is not mapped yet.