← All Foundations

Canon

Spacing

Spacing that just works. Based on φ (1.618), creating natural visual rhythm at every scale.

Published January 8, 2026

Spacing Scale

Built on the golden ratio (φ = 1.618). Each step is derived from φⁿ where base = 1rem.

TokenValueDerivationRecommended Use
--space-xs0.618rem (~10px)φ⁻¹Tight gaps, inline elements
--space-sm1rem (16px)φ⁰ (base)Form element gaps, small padding
--space-md1.618rem (~26px)φ¹Default component spacing
--space-lg2.618rem (~42px)φ²Card padding, section gaps
--space-xl4.236rem (~68px)φ³Large component gaps
--space-2xl6.854rem (~110px)φ⁴See guidance below
--space-3xl11.09rem (~177px)φ⁵See guidance below

Tailwind for Structure, Canon for Aesthetics

Important: The golden ratio produces mathematically elegant values, but --space-2xl (110px) and --space-3xl (177px) are impractical for most page-level padding.

Use Tailwind utilities for layout spacing:

  • Page padding: py-16, py-24, px-6
  • Section gaps: gap-8, space-y-12
  • Nav offset: calc(var(--header-height) + var(--space-md))

Use Canon tokens for component internals:

  • --space-xs through --space-xl work well for component padding, gaps, and margins

Usage Patterns

Component Padding

.button {
  padding: var(--space-xs) var(--space-sm);
}

.card {
  padding: var(--space-lg);
}

.modal {
  padding: var(--space-xl);
}

Stack Spacing

.stack > * + * {
  margin-top: var(--space-md);
}

.stack-lg > * + * {
  margin-top: var(--space-lg);
}

Grid Gaps

.grid {
  gap: var(--space-lg);
}

.grid-tight {
  gap: var(--space-sm);
}

Why Golden Ratio?

When spacing follows φ, adjacent elements feel balanced:

  • --space-xs × φ = --space-sm
  • --space-sm × φ = --space-md
  • --space-md × φ = --space-lg
  • --space-lg × φ = --space-xl

This creates rhythm without manual calculation.

Page Layout (Tailwind)

For page-level spacing, use Tailwind utilities which provide more practical values:

<!-- Section padding -->
<section class="py-16 px-6">
  <div class="max-w-5xl mx-auto">
    <!-- content -->
  </div>
</section>

<!-- Hero section -->
<section class="pt-24 pb-16 px-6">
  <!-- content -->
</section>

<!-- Fixed nav offset -->
<main class="pt-[calc(var(--header-height)+1.618rem)]">
  <!-- content -->
</main>