Spacing, radius & density
Prism never forks for a new audience. It reconfigures. The same components retune from a phone to a television, and from an airy onboarding flow to a dense admin table, by changing which values a small set of role tokens point at.
Spacing ruler & density
The 4px scale, the radius ladder, and the same controls at compact / neutral / relaxed. The density columns render real components, so the rhythm change is the system itself. Click a bar or radius tile to copy its token.
Two layers
Primitives are the 4px grid: --space-1 (4px) through --space-32 (128px), with two half-steps (--space-0-5, --space-1-5) for tight insets. Components do not use these directly for layout.
Roles say what a space is for. They point at a primitive, and which one depends on the device tier and the density. Layout is written in roles, so one attribute reflows a whole product.
The spacing roles
The five gaps form a ladder that always increases: things that belong together sit closer than things that do not.
| Role | What it separates | Mobile | Tablet | Desktop | Cinema |
|---|---|---|---|---|---|
--gap-inline | parts of one unit: icon and label, buttons in a group | 8 | 8 | 8 | 12 |
--gap-stack | lines in one block: label to input, heading to text | 12 | 16 | 16 | 24 |
--gap-group | sibling blocks: field to field, card to card | 24 | 24 | 24 | 40 |
--gap-section | page sections | 32 | 40 | 48 | 64 |
--gap-page | the content column from what is above and below it | 48 | 64 | 80 | 96 |
--layout-gutter | page edge padding | 16 | 24 | 32 | 64 |
--pad-card | inside a card | 16 | 20 | 24 | 40 |
--pad-surface | inside a dialog, drawer or panel | 20 | 24 | 32 | 48 |
--pad-control-x / -y | inside a control | 16 / 8 | 16 / 8 | 16 / 8 | 24 / 12 |
--control-height | buttons, inputs, selects | 40 | 40 | 40 | 56 |
All values are pixels at neutral density.
The radius roles
| Role | Used on | Mobile | Tablet and desktop | Cinema |
|---|---|---|---|---|
--radius-control | buttons, inputs, chips | 5 | 8 | 12 |
--radius-card | cards, tiles | 8 | 12 | 16 |
--radius-surface | dialogs, drawers, large panels | 12 | 16 | 24 |
--radius-media | images and video | 8 | 12 | 16 |
--radius-pill is reserved for switches, avatars and removable tags.
When one rounded shape sits inside another, use --radius-inset-card or --radius-inset-surface for the inner one. They subtract the padding from the outer radius so the two curves stay parallel.
Themes may set their own radii. Industry is tighter and squarer than the base theme, for example. Components that use the roles follow without change.
Device tiers
| Tier | Trigger | Character |
|---|---|---|
| mobile | base | tightest spacing and radius, touch targets, one column |
| tablet | ≥ 640px | slightly larger type and spacing |
| desktop | ≥ 1024px | full layout, widest gutters |
| cinema | data-scale="cinema" (or "tv") | large type, 56px controls, for screens read from across a room |
The first three follow the viewport width. Cinema never switches on by itself: a large monitor is still a desktop. The application sets data-scale="cinema" on <html> or on any part of the page, which also lets a television preview render at the right scale inside a desktop admin.
Density
Set data-density on <html> or any part of the page to trade whitespace for information.
| Density | Use for | Stack / group / section gap | Card padding | Control height |
|---|---|---|---|---|
compact | admin tables, reports, finance dashboards | 8 / 16 / 24 | 12 | 32 |
neutral | the default | by tier, as above | by tier | 40 |
relaxed | applications, onboarding, reading | 16 / 32 / 64 | 32 | 48 |
Density changes spacing and control height. It does not change font sizes.
How they compose
<html data-density="compact"> <!-- dense by default -->
<section data-density="relaxed"> … </section> <!-- one airy panel -->
<aside data-scale="cinema"> … </aside> <!-- a television preview -->
Each attribute applies to its own subtree, so they mix freely at any level with no per-component code.
Authoring rules
- A grid of tiles reads
--gap-tilefirst. Writegap: var(--gap-tile, var(--gap-group))on a dashboard grid or any grid of cards. Only a tiled theme sets the token (Industry: 4px, so tiles sit almost flush); everywhere else the fallback applies. Never use it between form fields. - Never hand-pick a padding or a radius. Use the role:
--pad-card,--gap-group,--gap-stack,--control-height,--radius-card. It already resolves for the tier and the density. - Space groups before borders do. The gap between groups is at least twice the gap within one.
- Touch targets should be at least 44px (
--size-touch). Default controls are 40px tall, and 32px at compact, so on touch surfaces use thelgsize or relaxed density. - Do not edit
tokens/scales.css. The roles are generated fromtokens/scale.config.json; change that file and regenerate. - Check each screen at all three densities and at the cinema tier.
Live specimens
Spacing scale
Size tiers · mobile → cinema
Density scale
Control sizing
Radius