Vertical Rhythm

Every size, spacing, and line-height token in ln is derived from two values: an 8px base grid and a 24px line grid.

The two grids

The entire spatial system rests on two Sass variables:

VariableDefaultRole
$g8pxBase grid step — the smallest unit. All horizontal spacing, padding, and component dimensions snap to multiples of this value.
$r24pxLine grid step (3 × $g) — every line-height, vertical margin, and section spacing is a multiple of this value, keeping text baselines aligned across columns.

Spacing tokens

The space token scale counts 8px steps. The token name is the multiplier, so --s3 equals 3 × 8px = 24px (one full line).

TokenValueGrid lines
--s-h4px (0.25rem)—
--s18px (0.5rem)—
--s216px (1rem)—
--s324px (1.5rem)1 line
--s432px (2rem)—

Use --s-h only for inline internals such as badge padding or tag gaps — it sits below the base grid.

Line heights

Every type token defines a line-height that is a whole multiple of 24px, so text stays on the line grid regardless of font size.

TokenSizeLine-heightLines
display-180px96px4
display-256px72px3
h140px48px2
h232px48px2
h3–h520–16px24px1
body, lead16–18px24px1
body-sm, code14px24px1
h6, body-xs, meta12px16px—

The 12px tokens use a 16px line-height that sits off the 24px grid. These are reserved for component internals where the surrounding box padding restores alignment.

Component heights

Interactive controls snap to the base grid so they align with text beside them:

SizeHeightGrid steps
Small32px4 × 8px
Default40px5 × 8px
Large48px6 × 8px (2 lines)

Customising the grid

Override $g and $r to change the grid density. The entire token scale recalculates automatically.

styles.scssscss
@use 'ln/scss' with (
  $g: 4px,   // tighter grid
  $r: 16px   // shorter line height
);

Keep $r as a whole multiple of $g so that line-grid multiples remain on the base grid.

Further reading

Grid overlay

Toggle the baseline grid overlay to verify alignment. Click the grid button at the bottom-right corner of any page, or add the show-grid class to <body>.

index.htmlhtml
<body class="show-grid">…</body>

The overlay draws horizontal lines at every 24px step and vertical lines at every 8px step, using the primary colour at low opacity.