Layout primitives

Measure

<forma-measure>

Constrains readable line measure without changing semantic structure.

Authoring tag
<forma-measure>
Behavior owner
Native CSS
Canonical source
patterns/measure.html

Purpose

Measure caps an element's inline size at a readable line length, 65 characters by default, while letting it shrink to the available width. It sets width only: it does not center, pad or style the content, so the surrounding composition still decides placement. Use it on text-heavy regions inside wide layouts, such as help text in a full-width settings page or an explanation above a dashboard, where long lines would otherwise slow reading.

Use when

  • Paragraph text sits in a region much wider than a comfortable line length.
  • A form or explanation should not stretch across a wide screen.
  • You need the measure without the typographic rhythm of long-form prose.

Avoid when

  • The content is a long article with headings, lists and quotes: use Prose, which includes measure and rhythm.
  • A whole page region on a marketing site needs a width and centering: use Container.
  • The content is tabular or a dashboard; a character measure would squeeze it. Use Grid or Bounded overflow.

Behavior to know

  • Width is min(100%, var(--forma-measure)), so the element never overflows its parent.
  • The ch unit scales with font size, so the measure stays proportional under text zoom.
  • The element stays at the inline start; wrap it in a centered container if centering is wanted.

Basic example

The smallest correct markup: the canonical pattern from patterns/measure.html inside its public tag. Copy this first, then adapt labels, names and state.

Canonical

Minimal measure

Rendered from the canonical pattern file.

Readable content measure

Measure constrains line length while allowing the surrounding composition to determine placement and available space.

HTML · Minimal measure Raw HTML for HTML · Minimal measure
<forma-measure class="forma-component-tag">
<article class="forma-measure">
  <h2>Readable content measure</h2>
  <p>Measure constrains line length while allowing the surrounding composition to determine placement and available space.</p>
</article>
</forma-measure>

Click or tap the code once to select all of it, then copy.

Examples

Scenario

Help text in a wide settings page

A description paragraph and a field constrained to a readable measure inside a full-width page section. The heading and the field share the same line length, so the eye does not travel across the whole screen.

Data retention

Choose how long we keep deleted projects before they are permanently removed. During this period an administrator can restore a project with all of its history, members and integrations.

HTML · Help text in a wide settings page Raw HTML for HTML · Help text in a wide settings page
<forma-measure class="forma-component-tag">
  <section class="forma-measure forma-stack" aria-labelledby="measure-settings-help-title">
    <h2 id="measure-settings-help-title">Data retention</h2>
    <p>Choose how long we keep deleted projects before they are permanently removed. During this period an administrator can restore a project with all of its history, members and integrations.</p>
    <div class="forma-field">
      <label class="forma-field__label" for="measure-settings-help-days">Days before permanent deletion</label>
      <input id="measure-settings-help-days" name="retention-days" type="number" min="1" max="365" value="30">
    </div>
  </section>
</forma-measure>

Click or tap the code once to select all of it, then copy.

Scenario

Short measure for a confirmation note

A tighter measure (--forma-measure: 45ch) for a short confirmation note in a card. Short lines make a brief message easier to take in at a glance.

Your export is being prepared. We will email a download link to the address on your account when it is ready, usually within ten minutes.

HTML · Short measure for a confirmation note Raw HTML for HTML · Short measure for a confirmation note
<forma-measure class="forma-component-tag">
  <div class="forma-surface">
    <p class="forma-measure" style="--forma-measure: 45ch">Your export is being prepared. We will email a download link to the address on your account when it is ready, usually within ten minutes.</p>
  </div>
</forma-measure>

Click or tap the code once to select all of it, then copy.

Mobile

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.

Mobile example

Mobile reading width

The same constrained text on a phone. The screen is narrower than 65ch, so the measure resolves to 100% and has no visible effect.

Viewport width

Frames narrower than the selected width show the component at the width available.

What changes at narrow widths

  • On phones the available width is less than 65ch, so min(100%, 65ch) resolves to the full width.
  • Text wraps normally and never scrolls horizontally.
  • Under 200% text zoom the ch-based measure grows with the font, so on tablets it keeps roughly the same number of characters per line.
  • Rotating to landscape lets the measure take effect again once the width exceeds 65ch.
HTML · Mobile reading width Raw HTML for HTML · Mobile reading width
<forma-measure class="forma-component-tag">
  <article class="forma-measure forma-stack" aria-labelledby="measure-mobile-measure-title">
    <h2 id="measure-mobile-measure-title">Why we ask for your phone number</h2>
    <p>We only use it to send sign-in codes when you turn on two-step verification. It is never shown to other members of your workspace.</p>
  </article>
</forma-measure>

Click or tap the code once to select all of it, then copy.

Baseline

Mobile · 320px

The canonical pattern in a true 320px viewport, the minimum width every Forma component must support without page-level horizontal scrolling.

Viewport width

Frames narrower than the selected width show the component at the width available.

API and configuration

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.

Native and ARIA attributes
AttributeOnValuesDefaultDescription
style.forma-measure--forma-measure: <length>—Per-instance line length, for example 45ch for short notes.
aria-labelledbysection / articleid of the heading—Names the constrained region by its heading.
CSS hooks (derived from dist/all.css)
HookKindValues or defaultDescription
.forma-measureBlock class—Sets inline-size: min(100%, var(--forma-measure)). No other styling.
--forma-measureCustom property—Maximum line length. Default 65ch.

Form behavior

Not a form control. A form or field group can be the measured element.

No keyboard interaction beyond the browser defaults for the elements in the markup.

States

Measure states
StateHow it is expressedPresentation
Constrainedparent wider than --forma-measureThe element stops at the measure; remaining space stays empty at the inline end.
Fluidparent narrower than --forma-measureThe element takes 100% of the parent.

Accessibility

Forma provides

  • Improves readability of long text by limiting line length.
  • Uses ch units, so the measure follows the user's text size.
  • Changes no semantics and adds no roles.

Your application supplies

  • Apply measure to text, not to tables or dashboards that need their full width.
  • Still structure content with headings and paragraphs; measure does not replace structure.

Responsive behavior

  • Intrinsic: clamps to 100% of the parent on narrow screens and to the measure on wide ones.
  • No breakpoints and no horizontal overflow at any width.
  • Combine with Container or margin in the parent composition when centering is needed.

Motion

  • No animation: the width is static.

Usage guidance

Do

  • Put measure on the element that holds the text, not on a page-level wrapper that also contains tables.
  • Use a shorter measure for brief notes and a longer one only for dense technical text.

Avoid

  • Expecting measure to center content; it only limits width.
  • Using px values for --forma-measure; they do not follow text zoom.

Verification specimens

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.