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));}5101520304050607080Reference: On typography and spacing scaling design
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.
| Property | CSS | Class examples | BP |
|---|---|---|---|
p | padding | -p:5, -p:20, … | ○ |
px | padding-inline | -px:10, -px:30, … | ○ |
py | padding-block | -py:15, -py:40, … | ○ |
m | margin | -m:10, -m:20, … | ○ |
mx | margin-inline | -mx:10, -mx:20, … | ○ |
my | margin-block | -my:10, -my:20, … | ○ |
my-s | margin-block-start | -my-s:10, -my-s:20, … | ○ |
g | gap | -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.).
| Property | CSS |
|---|---|
px-s | padding-inline-start |
px-e | padding-inline-end |
py-s | padding-block-start |
py-e | padding-block-end |
pl, pr, pt, pb | Physical direction padding |
mx-s | margin-inline-start |
mx-e | margin-inline-end |
my-e | margin-block-end |
ml, mr, mt, mb | Physical direction margin |
cg | column-gap |
rg | row-gap |
Margin Auto Support
Margin properties also have auto property classes in addition to spacing tokens.
| Property | CSS | Class |
|---|---|---|
m | margin | -m:auto |
mx | margin-inline | -mx:auto |
my | margin-block | -my:auto |
mx-s | margin-inline-start | -mx-s:auto |
mx-e | margin-inline-end | -mx-e:auto |
my-s | margin-block-start | -my-s:auto |
my-e | margin-block-end | -my-e:auto |
For details on each property class, see the Property Class reference table.
A complete list of Property Classes that map to CSS properties, with usage examples.