Search

Spacing Tokens

This page covers Lism’s Fibonacci-based spacing tokens and the property classes that use them.

SPACE: Spacing Scale

Spacing is built on a scale derived from the Fibonacci sequence ((0, 1,) 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, …).

By default, 0.5rem ≈ 8px is used as the scaling unit, with token values 10, 20, 30, … 80 defined accordingly. However, because those gaps can feel too coarse in practice, 5 and 15 are added as fine-tuning steps at the lower end of the scale.

:root {
/* Fibonacci scale with spacing unit of 8 */
--s-unit: calc(var(--REM) * 0.5); /* ≒ 8px */
--s5: calc(0.5 * var(--s-unit)); /* exception */
--s10: var(--s-unit);
--s15: calc(1.5 * var(--s-unit)); /* exception */
--s20: calc(2 * var(--s-unit));
--s30: calc(3 * var(--s-unit));
--s40: calc(5 * var(--s-unit));
--s50: calc(8 * var(--s-unit));
--s60: calc(13 * var(--s-unit));
--s70: calc(21 * var(--s-unit));
--s80: calc(34 * var(--s-unit));
}
Preview
5
10
15
20
30
40
50
60
70
80
Resize

Supported Property Classes

Spacing tokens work with padding, margin, and gap property classes, but not every property has a preset class.

Full Support (Token Values 5–80)

The following properties have property classes for all spacing tokens: 5, 10, 15, 20, 30, 40, 50, 60, 70, 80.

PropertyCSSClass examplesBP
ppadding-p:5, -p:20, …
pxpadding-inline-px:10, -px:30, …
pypadding-block-py:15, -py:40, …
mmargin-m:10, -m:20, …
mxmargin-inline-mx:10, -mx:20, …
mymargin-block-my:10, -my:20, …
my-smargin-block-start-my-s:10, -my-s:20, …
ggap-g:10, -g:20, …

gap also supports inherit.

No Preset Classes

These properties have no preset spacing-token classes, but you can still specify values via CSS custom properties (--px-s, etc.) or JSX props (px-s="20", etc.).

PropertyCSS
px-spadding-inline-start
px-epadding-inline-end
py-spadding-block-start
py-epadding-block-end
pl, pr, pt, pbPhysical direction padding
mx-smargin-inline-start
mx-emargin-inline-end
my-emargin-block-end
ml, mr, mt, mbPhysical direction margin
cgcolumn-gap
rgrow-gap

Margin Auto Support

Margin properties also have auto property classes in addition to spacing tokens.

PropertyCSSClass
mmargin-m:auto
mxmargin-inline-mx:auto
mymargin-block-my:auto
mx-smargin-inline-start-mx-s:auto
mx-emargin-inline-end-mx-e:auto
my-smargin-block-start-my-s:auto
my-emargin-block-end-my-e:auto

For details on each property class, see the Property Class reference table.

© Lism CSS. All rights reserved.