Preview content
Architecture assessment
This surface shows the exact material the user is expected to review before a consequential operation.
<forma-preview-surface>
A bounded review surface for consequential content before an application commits or publishes it.
<forma-preview-surface>patterns/preview-surface.htmlA preview surface frames exactly what will be sent, published, issued or committed, so the user can review it before an application-owned operation. It has a header naming what is previewed with optional view controls, a tinted canvas that visually separates the previewed material from the application around it, and a footer that states the commit status and holds the next step. The frame is presentation only: showing a preview never means the operation is authorized, and the footer must say in text that nothing has been committed yet.
article inside it is a centered page up to 42rem wide.The smallest correct markup: the canonical pattern from patterns/preview-surface.html inside its public tag. Copy this first, then adapt labels, names and state.
Rendered from the canonical pattern file.
Static specimen. Its buttons stand for application actions that the consuming application implements; this script-free documentation does not perform them. Its controls are shown for their markup and appearance and cannot be operated here.
Preview content
This surface shows the exact material the user is expected to review before a consequential operation.
<forma-preview-surface class="forma-component-tag">
<section class="forma-preview-surface" aria-labelledby="preview-title">
<header class="forma-preview-surface__header">
<div><span class="forma-status-lozenge">Preview</span><h3 id="preview-title">Customer invoice</h3></div>
<div class="forma-preview-surface__controls"><button type="button">Desktop</button><button type="button">Mobile</button></div>
</header>
<div class="forma-preview-surface__canvas">
<article>
<p class="forma-record-header__type">Preview content</p>
<h2>Architecture assessment</h2>
<p>This surface shows the exact material the user is expected to review before a consequential operation.</p>
</article>
</div>
<footer class="forma-preview-surface__footer"><span>Not yet committed</span><button type="button">Continue review</button></footer>
</section>
</forma-preview-surface>
Click or tap the code once to select all of it, then copy.
An email announcement previewed before it goes to every customer. The view controls are toggle buttons with aria-pressed, the footer states the audience and that nothing has been sent, and the send action is a separate application-owned button.
Static specimen. Its buttons stand for application actions that the consuming application implements; this script-free documentation does not perform them. Its controls are shown for their markup and appearance and cannot be operated here.
Hello, the dashboard will be read-only from 02:00 to 03:30 UTC while we upgrade our database. No data will be lost.
<forma-preview-surface class="forma-component-tag">
<section class="forma-preview-surface" aria-labelledby="preview-surface-announcement-title">
<header class="forma-preview-surface__header">
<div><span class="forma-status-lozenge">Preview</span><h3 id="preview-surface-announcement-title">Maintenance announcement</h3></div>
<div class="forma-preview-surface__controls" role="group" aria-label="Preview width">
<button type="button" aria-pressed="true">Desktop</button>
<button type="button" aria-pressed="false">Mobile</button>
</div>
</header>
<div class="forma-preview-surface__canvas">
<article aria-labelledby="preview-surface-announcement-subject">
<h2 id="preview-surface-announcement-subject">Scheduled maintenance on 14 October</h2>
<p>Hello, the dashboard will be read-only from 02:00 to 03:30 UTC while we upgrade our database. No data will be lost.</p>
</article>
</div>
<footer class="forma-preview-surface__footer">
<span>Not sent · 4,210 recipients</span>
<button type="button">Send announcement</button>
</footer>
</section>
</forma-preview-surface>
Click or tap the code once to select all of it, then copy.
The preview renders, but the application has found a problem that blocks publishing. The footer says so in text and offers only the legal next step; there is no disabled Publish button that looks available.
Static specimen. Its buttons stand for application actions that the consuming application implements; this script-free documentation does not perform them. Its controls are shown for their markup and appearance and cannot be operated here.
Bulk export now supports CSV and Parquet. See the migration guide for [missing link].
<forma-preview-surface class="forma-component-tag">
<section class="forma-preview-surface" aria-labelledby="preview-surface-blocked-publish-title">
<header class="forma-preview-surface__header">
<div><span class="forma-status-lozenge" data-state="blocked">Cannot publish</span><h3 id="preview-surface-blocked-publish-title">Release notes 4.2</h3></div>
</header>
<div class="forma-preview-surface__canvas">
<article aria-labelledby="preview-surface-blocked-publish-heading">
<h2 id="preview-surface-blocked-publish-heading">What's new in 4.2</h2>
<p>Bulk export now supports CSV and Parquet. See the migration guide for [missing link].</p>
</article>
</div>
<footer class="forma-preview-surface__footer">
<span>Not published · 1 broken link must be fixed first</span>
<button type="button">Return to editor</button>
</footer>
</section>
</forma-preview-surface>
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.
At phone width the header and footer stack, the canvas padding shrinks and the previewed page fills the width.
Static specimen. Its buttons stand for application actions that the consuming application implements; this script-free documentation does not perform them. Its controls are shown for their markup and appearance and cannot be operated here.
clamp() with 4vw, shrinking to 1rem each at 320px so the previewed content keeps most of the width.<forma-preview-surface class="forma-component-tag">
<section class="forma-preview-surface" aria-labelledby="preview-surface-mobile-title">
<header class="forma-preview-surface__header">
<div><span class="forma-status-lozenge">Preview</span><h3 id="preview-surface-mobile-title">Invoice INV-1042</h3></div>
</header>
<div class="forma-preview-surface__canvas">
<article aria-labelledby="preview-surface-mobile-heading">
<h2 id="preview-surface-mobile-heading">Acme Manufacturing</h2>
<p>Consulting, September · $5,000.00 · due 4 October 2026</p>
</article>
</div>
<footer class="forma-preview-surface__footer">
<span>Not issued</span>
<button type="button">Issue invoice</button>
</footer>
</section>
</forma-preview-surface>
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 buttons stand for application actions that the consuming application implements; this script-free documentation does not perform them. 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-labelledby | root section, article | id of the preview title | — | Names the preview region by what is being previewed. |
aria-pressed | view control buttons | true | false | — | Marks which preview width or mode is active. The application toggles it and changes the preview. |
role | controls container | group | — | Groups the view controls under one name. |
aria-label | controls container | string | — | Names the control group, for example "Preview width". |
| Hook | Kind | Values or default | Description |
|---|---|---|---|
.forma-preview-surface | Block class | — | Root bordered region. |
.forma-preview-surface__canvas | Element class | — | Tinted, padded area that holds the previewed material. A direct article child is drawn as a centered page up to 42rem wide. |
.forma-preview-surface__controls | Element class | — | Wrapping group of view controls in the header. |
.forma-preview-surface__footer | Element class | — | Commit status and next action; wraps and stacks at 40rem and below. |
.forma-preview-surface__header | Element class | — | Title row with optional controls; a flex row that stacks at 40rem and below. |
| Keys | Result |
|---|---|
| Tab / Shift+Tab | Moves through header controls, any links inside the previewed content, then footer actions. |
| Enter / Space | Activates the focused button. Native button behavior; the effect is application-owned. |
| Event | Description |
|---|---|
click | Native click on view controls and footer actions. The application changes the preview or performs the operation. |
Not a form control. Footer actions may be submit buttons of an application form around the surface.
| State | How it is expressed | Presentation |
|---|---|---|
| Uncommitted | footer text | The footer states that the content has not yet been sent, published or issued. |
| Blocked | status text and the actions the application renders | The application explains the problem and offers only legal next steps. |
| View mode | aria-pressed on header controls | Which presentation the preview is showing; application-owned. |
| Stacked chrome | @media (max-width: 40rem) | Header and footer items stack and stretch. |
align-items: stretch.clamp(1rem, 4vw, 3rem) and the article's padding clamp(1rem, 4vw, 2.5rem).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.