Components / surfaces
Prose
A column of rendered writing — markdown, a document, a journal entry — dressed by element, because its author could not write a type role on each one.
Summary
A column of rendered writing — markdown, a document, a journal entry — dressed by element, because its author could not write a type role on each one.
| APG pattern | none |
| Built on | native elements |
| Status | self-tested |
| Since | 0.7.0 |
<Prose dangerouslySetInnerHTML={{ __html: rendered }} />
<Prose as="article" measure="wide">
<h2>How the run is made equal</h2>
<p>One PGlite, the monorepo's migrations and seed…</p>
</Prose>
Anatomy
A <div data-se="prose" data-se-text="body"> by default, around HTML it does not own — the body role is part of the anatomy, so paragraphs and lists inherit it and a consumer writing the markup by hand writes it too. There are no parts: the content is the author's markup, and the stylesheet selects elements inside the frame — headings, paragraphs, lists, code, quotes, tables, rules, images, links — by tag.
| Part | Element | Required |
|---|---|---|
scroller | the caller's | the caller's |
<article data-se="prose" data-se-text="body" data-measure="wide">
<h2>How the run is made equal</h2>
<p>One PGlite, the monorepo's migrations and seed, restored between the two sides…</p>
<ul><li>One stubbed network.</li></ul>
<pre><code>npm run test:parity</code></pre>
</article>
Every selector is a descendant selector on purpose, and every one is scoped by the element it dresses: [data-se="prose"] h2, never [data-se="prose"] [data-part="…"]. A component placed inside prose — a Card, an Alert — keeps its own rules because they are written on data-se and data-part, which Prose never selects.
Properties
| Property | Values | Default | What it does |
|---|---|---|---|
measure | tight · base · wide | base | The line length, from the three measure tokens. base for reading; tight for a caption or an aside beside something else; wide for a reference page the reader scans. Written as data-measure; the default writes nothing. |
as | keyof React.JSX.IntrinsicElements | none | The element to render. div by default. Use article for a self-contained document, section under the page's own heading. |
children | React.ReactNode | none | The rendered writing. Usually it arrives as HTML from a markdown renderer; the component reads none of it. |
States
| State | Expressed as | |
|---|---|---|
| Focused | :focus-visible | |
| Hover | :hover |
Behavior
None. It is a stylesheet scope with a measure.
Accessibility
The heading order is the author's, and Prose leaves it alone. It sizes h1 through h6 and changes none of their levels. A document whose first heading is an h3 has an outline problem that CSS cannot see and must not hide.
A wide table scrolls, and a bare one scrolls for a pointer only. CSS can clip and scroll a table but cannot give it a tab stop, so a keyboard reaches the far columns only when the renderer wraps the table in the scroller part — a named, focusable region. Rendered markdown usually can be told to; where it cannot, the far columns are reachable by pointer and touch and not by keyboard, which is a limit to know rather than a reason to widen the page.
Links inside prose keep their underline. Link's standalone form drops it, because a standalone link has nothing around it to be confused with; a link in running text has every other word.
Code is marked up, not merely styled. <code> and <pre> get the code face; a span with a monospace style gets nothing, and a screen reader hears the difference.
Keyboard
None of its own. Links and any control the author placed inside are their own tab stops.
Roles, states and properties
_None written. The elements carry their own._
Focus
Never takes focus.
Screen reader
Not recorded as verified. Stage 4 of the readiness ladder — driving each component with VoiceOver and NVDA — is unstarted across the package, and no component should claim otherwise until docs/journal/ records the session that did it.
Contrast and target size
npm run check:contrast audits every color pair this component uses across all four skins, light and dark, and fails the build on a shortfall. Two waivers are on the record in docs/audit/DEFERRED.md.
It sets no target size of its own; anything interactive inside it brings its own.
Tested
test/apg/stat-prose.test.jsxtest/browser/stat-prose.spec.mjstest/browser/surfaces.spec.mjs
Known gaps
_No upstream requirement is recorded as not applicable._
Appearance
Prose assigns the type roles by element instead of by attribute, and adds the two things a role never sets: vertical rhythm and a measure.
h1takesheading,h2subheading,h3crosshead;h4toh6are body size at medium weight. Prose never usestitle: the page title belongs toPageShell's header, outside the column, and a document body that carries its ownh1— the builder's docs reader, for one — must not outrank the page it sits in.p,liandblockquoteinheritbodyfrom the root, so nothing is written for them;codeandpretakecodeby tag, on the sunk surface, inline code at the small radius.- Rhythm is written once, as the gap between siblings:
--se-space-3between blocks,--se-space-1between list items,--se-space-5above a heading,--se-space-2below it,--se-space-6around apre, a table or a figure. Nothing carries a margin of its own. - A
blockquotecarries a hairline on its start edge in--se-borderand muted text. Anhris the same hairline, full width. A table takes the hairlinesDataTabledraws, without its sorting; a wide one scrolls sideways inside its own box rather than widening the page, and a narrow one is as wide as its content. A renderer that can wrap a table in<div data-part="scroller" role="region" aria-label="…" tabindex="0">gets whatDataTable's frame is — a named region with a tab stop and the ring — and inside it the table fills the width again. - Images and figures fill the measure; a
figcaptionis small and muted. - The measure is
max-inline-sizeon the frame, from the token themeasureproperty names.
| Token | Used for |
|---|---|
--se-accent | color |
--se-border | background, border-block-end, border-inline-start |
--se-border-strong | border-block-end-color |
--se-border-width | block-size, border-block-end, border-inline-start, text-decoration-thickness |
--se-focus-color | outline |
--se-focus-width | outline, outline-offset |
--se-font-code | font-family |
--se-font-sans | font-family |
--se-leading-heading | line-height |
--se-measure-base | max-inline-size |
--se-measure-tight | max-inline-size |
--se-measure-wide | max-inline-size |
--se-radius-md | border-radius |
--se-radius-sm | border-radius |
--se-space-1 | margin-block-start, padding |
--se-space-2 | margin-block-start, padding |
--se-space-3 | margin-block-start, padding |
--se-space-4 | padding, padding-inline-start |
--se-space-5 | margin-block-start, padding-inline-start |
--se-space-6 | margin-block-start |
--se-surface-sunk | background |
--se-text | color |
--se-text-2xl | font-size |
--se-text-lg | font-size |
--se-text-md | font-size |
--se-text-muted | color |
--se-text-sm | font-size |
--se-text-xl | font-size |
--se-tracking-body | letter-spacing |
--se-tracking-heading | letter-spacing |
--se-weight-medium | font-weight |
--se-weight-semibold | font-weight |
Motion
None.
Content
The words are the author's. What the frame asks for is markup that says what it is — a heading as a heading, a list as a list, code as <code> — because that is all Prose can see.
Usage
Prose is for writing the author could not annotate. Markdown rendered to HTML, a document from a store, a journal entry. Where the author writes the markup by hand, write the type role on the element and leave Prose out — a role is the same treatment with no scope and no measure to argue with.
Prose sets the measure because it is the column. The type layer refuses a measure on a role, because a line length depends on the column the text sits in and a role cannot see it. Prose can: it is the column. That is the one thing it adds that the roles never will.
Never nest a component's words in it to get the type. A Card body inside prose takes the prose rhythm on its paragraphs, which is usually not what the card wants. Put the card beside the prose, or give the card's text its own roles.
When not to use it. For interface copy — a label, a description, an empty state — use the type roles. For a long page the author composes by hand, roles and layout primitives; Prose would dress every paragraph the same and the author wanted to decide.
Notes
The builder restyled all markdown under .dc-body and said in its stylesheet that the system had no prose anatomy. The review agreed it was a gap on 15 Oct 2026. Hosting-event and the studio each had a version of the same block.
Element selectors, inside one attribute scope, is the shape — and it is the only place in the system that dresses by tag. The rule everywhere else is that a component selects on data-se and data-part, so that a class or a tag never carries meaning. Prose is the exception because rendered markdown carries nothing else; it is written down here so it is not copied. check:type knows the scope: a prose rule that restates a role is listed as restated by necessity, each one the role's declarations verbatim, and the report names any that drift.
A wide table widened the page (the builder's adoption, 15 Oct 2026). Tables were laid at 100% with no overflow, so a table wider than the column pushed the page wider — the builder wrote .dc-body table { display: block; overflow-x: auto } around it. Prose lays a table that way itself now, and offers the scroller part for the keyboard path CSS cannot supply.
No color on the roles stays true inside Prose. Prose sets --se-text once on the frame and --se-text-muted on captions and quotes; the heading roles it assigns set no color, as the type layer rules.