Skip to content

Spatial Rhythm, Grouping & Layout

Spacing is not a bag of interchangeable empty pixels. It tells people what belongs together, where one task ends, where another begins, and what deserves attention.

A spacing scale supplies the vocabulary. Spatial rhythm determines how that vocabulary is composed.

A product may use a 4px, 5px, 8px, fluid, or mixed primitive scale. None of those choices determines whether the interface has good rhythm. Rhythm comes from applying the scale according to content, proximity, repetition, hierarchy, typography, density, and viewport.

This standard separates two decisions:

  1. Relationship grammar — which elements should feel closer or farther apart.
  2. Token resolution — which project-specific values express those relationships in a particular interface.

The relationship grammar is reusable. The resolved values belong to the product and context.

This page combines accessibility requirements with design guidance. They are not interchangeable:

  • WCAG 2.2 defines requirements for pointer-target size and spacing, and for layouts to survive user-applied text spacing.
  • W3C cognitive accessibility guidance recommends white space for clearer chunks and less overwhelming presentation, but identifies this as supplemental guidance rather than a WCAG conformance requirement.
  • The relationship ranks, composition patterns, density guidance, and optical adjustments below are design guidance. They are not universal accessibility thresholds.

Use five ordered relationships. The ranks describe relative separation, not ratios, multiples, or pixel values.

attached < associated < grouped < separated < sectional
RankRelationshipIntentTypical examples
1AttachedElements form one immediate reading or interaction unitIcon + label; value + unit; media + caption
2AssociatedDistinct elements directly explain or operate on one anotherLabel + input; input + error; title + description
3GroupedPeer items belong to one collection, task, or repeated patternField + field; list item + list item; toolbar controls
4SeparatedGroups remain related within a region but perform different rolesFields + actions; filters + results; card content + footer
5SectionalMajor regions need the strongest pause in the page rhythmPage section + page section; article + related resources

Resolve these ranks using the product’s existing tokens. A compact enterprise table and a spacious editorial page may map them differently while preserving the same order.

A mechanically consistent layout can still be semantically wrong. For example:

  • Equal space above and below a heading makes it unclear which content the heading introduces.
  • Equal gaps between a label, input, help text, and the next field flatten two relationships into one.
  • Card padding that equals the gap between cards weakens the card boundary.
  • A uniform vertical Stack applied to every child produces consistency without hierarchy.

When two values conflict, preserve the intended relationship before preserving mathematical symmetry.

These diagrams deliberately omit pixel labels. They demonstrate which spaces should be closer or farther apart; the product still decides the values.

Relationship ladder. Separation grows with semantic distance. The steps show order, not a required ratio.
Uniform spacing Weak grouping
Every sibling receives the same gap, so help text drifts between fields and the action reads like another input.
Relational rhythm Clear grouping
Labels and help stay associated with their controls; fields form a group; the action gets a stronger pause.
Editorial flow Asymmetric on purpose
A heading is farther from the section it ends than from the content it introduces. Mathematical symmetry would weaken the reading cue.
Responsive settings Relationship preserved
The layout changes, but the control remains inside its setting. Responsive rhythm preserves meaning rather than desktop coordinates.

Repeated peers should use the same spatial pattern. A list, settings category, card collection, or form becomes easier to scan when each instance repeats its internal rhythm.

Compare repeated instances for:

  • internal padding;
  • label-to-content gaps;
  • sibling gaps;
  • alignment;
  • the position of actions or metadata; and
  • responsive behaviour.

An unexplained change is more disruptive than a value that happens not to sit on a preferred mathematical grid.

If every gap is equal, the page has a beat but no phrasing. Deliberate variation creates pauses, transitions, and emphasis.

Use stronger separation when:

  • the user moves to a different subtask;
  • controls affect a different region;
  • the content changes topic or responsibility;
  • a repeated sequence ends; or
  • a high-priority element needs room to be perceived.

Do not add large space merely to make an interface feel premium. Empty space without a relational purpose can fragment a task and push important content out of view.

Line height, paragraph spacing, heading margins, list rhythm, captions, and measure form one system.

In editorial flow:

  • keep a heading closer to the content it introduces than to the content it concludes;
  • keep captions attached to their media;
  • use larger pauses between sections than between paragraphs;
  • balance page gutters with line length; and
  • treat a baseline grid as an alignment aid rather than an inflexible production rule.

Figma’s typography guidance describes 8-point grids and 4-point baselines as one useful way to establish vertical rhythm, while warning against enforcing them rigidly across real devices and rendered code.

Responsive spacing is not “desktop values minus one token.” Preserve the relationship grammar while recomposing the layout.

  • Protect attached and associated relationships first.
  • Recompose columns before compressing every gap.
  • Reduce large sectional pauses only when they consume space without improving orientation.
  • After controls stack, keep each control closer to its own label or description than to the next item.
  • Allow stronger sectional pauses and wider gutters where they improve hierarchy.
  • Do not stretch attached pairs simply because space is available.
  • Prevent arbitrary voids between columns with unequal content.
  • Review whether a task still feels continuous when more content appears above the fold.

Some spatial roles can interpolate between small- and large-screen values using clamp() or an equivalent project system. Fluid spacing works best when the endpoints are deliberate and the relationship order remains stable throughout the range.

Utopia’s fluid space approach is a useful implementation reference: it defines project-specific small- and large-screen palettes, then lets the browser interpolate between them. It is an option, not a requirement.

Density changes token resolution, not semantic relationships.

ModeGuidance
CompactUse a tighter subset of the product scale, preserve visible region boundaries, and never compress target or text requirements away.
ComfortableUse the product’s default mapping with clear contrast between internal, grouped, and sectional relationships.
SpaciousUse more generous tokens without stretching attached pairs or fragmenting a continuous task.

Avoid a global multiplier that scales every gap equally. Dense data regions, navigation, body content, and page sections may need different adjustments.

Mathematical equality and visual equality are not always the same. Icons contain internal whitespace; typefaces have different metrics; rounded and irregular shapes carry different visual weight.

Optical adjustment is appropriate when it restores balance or relational meaning. Prefer a supported neighbouring token. When a raw value is necessary, record:

  • the affected pair;
  • the reason;
  • the viewport or density mode;
  • why a supported token did not work; and
  • how the rendered result was reviewed.

Do not treat every off-scale measurement as a failure. Do treat unexplained exceptions and repeated-component drift as review findings.

External spacing belongs to the relationship between siblings. Parents should normally control it with gap, a Stack, a Cluster, or another composition primitive. Components should control their internal padding.

.field-stack {
display: grid;
gap: var(--space-field-to-field);
}
.field {
display: grid;
gap: var(--space-label-to-control);
}
.section-stack {
display: grid;
gap: var(--space-section-to-section);
}

The semantic aliases resolve to the product’s primitive scale:

:root {
--space-label-to-control: var(--project-space-associated);
--space-field-to-field: var(--project-space-grouped);
--space-section-to-section: var(--project-space-sectional);
}

This avoids leftover child margins, accidental gap + margin doubling, and components that carry the wrong external spacing into a new context.

label → control associated
control → help/error associated
field → field grouped
field group → actions separated

Do not use one universal gap between every direct child of a form. The user should be able to assign help and error text to the correct field by position alone.

setting label → description associated
setting copy → control associated
setting row → setting row grouped
category → category sectional

When rows stack on small screens, the control must remain visually inside its setting rather than drifting toward the next row.

title → description associated
card content → actions separated
card → card grouped
collection → next section sectional

Keep repeated card padding and internal patterns consistent. The gap between cards should not be confused with the padding inside a card.

heading → introduced content associated
paragraph → paragraph grouped
media → caption attached
section → section sectional

Coordinate type and space as one reading rhythm rather than styling every element in isolation.

metric label → value attached
panel title → content associated
controls → affected region associated
region → region separated

Use compact repeated rhythms inside dense regions and stronger pauses between responsibilities. A dashboard should not be uniformly dense or uniformly spacious.

FailureWhy it happensReview response
Universal gap everywhereThe agent treats a primitive scale as layout semanticsLabel each relationship before choosing tokens
Evenly padded “card soup”Every region is generated from the same card recipeDistinguish collections, subsections, and page regions
Label driftThe field is implemented as unrelated siblingsWrap the field and let its parent own the associated gap
Double spacingParent gap combines with child marginsReset child flow margins inside the composition primitive
Desktop rhythm copied to mobileValues change without recomposing relationshipsStack regions and recheck nearest-neighbour meaning
Mathematically perfect, optically wrongBounding boxes are mistaken for visual weightReview icons, type metrics, and irregular shapes visually
Arbitrary one-off valuesThe agent fixes symptoms without a semantic modelResolve to a named relationship or document the exception
  • Can each label, message, control, and caption be assigned to the correct content by position alone?
  • Are gaps within a group smaller than gaps between groups?
  • Do repeated peers use the same rhythm?
  • Are deliberate changes of rhythm communicating a real transition or priority?
  • Is each heading closer to the content it introduces?
  • Do page regions remain distinguishable without relying only on borders or colour?
  • Does the relationship order survive small, medium, and large viewports?
  • Does compact mode preserve targets, readability, and regional boundaries?
  • Are optical exceptions documented and reviewed in the rendered interface?
  • Has the interface been checked with realistic content, text resizing, and translated strings?

The Human Standards MCP server exposes get_spatial_rhythm. Call it before generating a layout and again during rendered review.

{
"pattern": "form-stack",
"density": "comfortable",
"viewport": "small"
}

The tool returns:

  • the ordered relationship grammar;
  • the selected composition pattern;
  • density and viewport guidance;
  • product-token resolution instructions;
  • manual review questions;
  • evidence boundaries; and
  • canonical references.

The MCP does not return a universal pixel scale. If the product already has spacing tokens, the agent must map the relationship ranks to those tokens. If no scale exists, any proposed values are a project hypothesis that must be tested with realistic content and rendered review.

  1. Identify the composition pattern and semantic relationships.
  2. Retrieve the relevant spatial-rhythm contract.
  3. Resolve relationship ranks using the product’s tokens, density, type, platform, and viewport.
  4. Implement external spacing in parent composition primitives.
  5. Render realistic content at representative widths.
  6. Compare computed spacing across repeated components.
  7. Review grouping, hierarchy, responsive rhythm, and optical balance visually.
  8. Correct the implementation before calling it complete.