Skip to content

Spacing

Tessera UI provides a spacing scale built on CSS custom properties. The scale uses a curated set of values rather than a linear sequence, which means some numbers are intentionally skipped.


The table below shows every spacing token, its CSS value, and the resolved pixel size across all three density modes.

TokenDefault (Comfortable)CompactSpaciousVisual
--ts-spacing-0000
--ts-spacing-10.375rem (6px)0.25rem (4px)0.5rem (8px)
--ts-spacing-20.625rem (10px)0.5rem (8px)0.75rem (12px)
--ts-spacing-31rem (16px)0.75rem (12px)1.25rem (20px)
--ts-spacing-41.25rem (20px)1rem (16px)1.5rem (24px)
--ts-spacing-51.5rem (24px)1.25rem (20px)2rem (32px)
--ts-spacing-62rem (32px)1.5rem (24px)2.5rem (40px)
--ts-spacing-82.5rem (40px)2.5rem (40px)2.5rem (40px)
--ts-spacing-103rem (48px)3rem (48px)3rem (48px)
--ts-spacing-124rem (64px)4rem (64px)4rem (64px)
--ts-spacing-165rem (80px)5rem (80px)5rem (80px)

Tokens 7, 9, 11, and 13-15 are intentionally skipped — the scale maps to the geometric progression used across the component library. Rather than providing a value at every integer, the scale includes only the steps that are actually needed for consistent visual rhythm. This avoids “in-between” sizes that would create ambiguity and inconsistent spacing decisions.

The numbering after --ts-spacing-6 switches to even increments (8, 10, 12, 16) because at larger sizes the visual difference between adjacent steps is less perceptible and fewer stops are needed. The numbers themselves reflect relative magnitude rather than a sequential index.

Do not create custom tokens to fill the gaps. If you find yourself needing a value between two existing tokens, consider whether one of the existing tokens is a better fit for the use case.


TokenDefault ValueTypical Usage
--ts-spacing-00Reset spacing, flush alignment
--ts-spacing-16pxTightest gap — icon to label, label to field
--ts-spacing-210pxInline padding, small gaps between related items
--ts-spacing-316pxStandard component internal padding
--ts-spacing-420pxSection gaps, medium component padding
--ts-spacing-524pxCard padding, form group separation
--ts-spacing-632pxLarge container padding, section dividers
--ts-spacing-840pxPage section separation
--ts-spacing-1048pxMajor layout regions
--ts-spacing-1264pxPage-level vertical rhythm
--ts-spacing-1680pxHero sections, maximum breathing room

Always reference spacing tokens rather than hard-coded values:

/* Correct */
.card {
padding: var(--ts-spacing-3);
gap: var(--ts-spacing-2);
}
/* Incorrect -- bypasses density modes */
.card {
padding: 16px;
gap: 10px;
}

Using tokens ensures your layout automatically adjusts when a user or container switches density via the data-density attribute. See the Layout page for density modes, grid system, and breakpoint details.