Layout

Spacing

Spacing scale and usage guidelines

Production

Consistent spacing creates visual rhythm and hierarchy. Our spacing scale matches the Tailwind CSS default scale based on a 4px base unit.

Spacing Scale

Our spacing scale is based on a 4px base unit. Every token maps directly to a Tailwind utility class.

TokenPixelsTailwindUsage
00pxp-0 / gap-0-
px1pxp-px / gap-px-
0.52pxp-0.5 / gap-0.5-
14pxp-1 / gap-1-
1.56pxp-1.5 / gap-1.5-
28pxp-2 / gap-2-
2.510pxp-2.5 / gap-2.5-
312pxp-3 / gap-3-
3.514pxp-3.5 / gap-3.5-
416pxp-4 / gap-4-
520pxp-5 / gap-5-
624pxp-6 / gap-6-
728pxp-7 / gap-7-
832pxp-8 / gap-8-
936pxp-9 / gap-9-
1040pxp-10 / gap-10-
1144pxp-11 / gap-11-
1248pxp-12 / gap-12-
1456pxp-14 / gap-14-
1664pxp-16 / gap-16-
2080pxp-20 / gap-20-
2496pxp-24 / gap-24-
28112pxp-28 / gap-28-
32128pxp-32 / gap-32-
36144pxp-36 / gap-36-
40160pxp-40 / gap-40-
44176pxp-44 / gap-44-
48192pxp-48 / gap-48-
52208pxp-52 / gap-52-
56224pxp-56 / gap-56-
60240pxp-60 / gap-60-
64256pxp-64 / gap-64-
72288pxp-72 / gap-72-
80320pxp-80 / gap-80-
96384pxp-96 / gap-96-

Semantic Tokens

Component Spacing

TokenValueTailwindUse Case
xs4pxp-1Component padding
sm8pxp-2Component padding
md16pxp-4Component padding
lg24pxp-6Component padding
xl32pxp-8Component padding

Element Gaps

TokenValueTailwindUse Case
xs2pxgap-0.5Element gap
sm4pxgap-1Element gap
md8pxgap-2Element gap
lg12pxgap-3Element gap
xl16pxgap-4Element gap

Section Spacing

TokenValueTailwindUse Case
xs24pxgap-6Section gap
sm32pxgap-8Section gap
md48pxgap-12Section gap
lg64pxgap-16Section gap
xl96pxgap-24Section gap

Common Patterns

Card layout

<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
  <div class="p-6 rounded-lg">Card content</div>
</div>

Form spacing

<form class="flex flex-col gap-6">
  <div class="flex flex-col gap-2">
    <label>Field label</label>
    <input class="p-3" />
  </div>
</form>

Page section

<section class="py-16 px-6">
  <div class="container mx-auto flex flex-col gap-8">
    Section content
  </div>
</section>

Principles

  1. Use the scale: Avoid arbitrary values; stick to the defined tokens
  2. Be consistent: Same elements should have same spacing
  3. Create hierarchy: More important content gets more breathing room
  4. Consider context: Mobile needs tighter spacing than desktop