Spacing

The 4px-based spacing grid used for consistent layout and component sizing.

Base Unit

All spacing in the FRAYT Design System snaps to a 4px grid (0.25rem). This creates visual rhythm and ensures consistent alignment across all components and layouts.

Spacing Scale

0.5
0.125rem (2px)
1
0.25rem (4px)
1.5
0.375rem (6px)
2
0.5rem (8px)
3
0.75rem (12px)
4
1rem (16px)
5
1.25rem (20px)
6
1.5rem (24px)
8
2rem (32px)
10
2.5rem (40px)
12
3rem (48px)
16
4rem (64px)
20
5rem (80px)
24
6rem (96px)

Usage

Use Tailwind's spacing utilities, which are based on the same 4px grid:

// Padding
<div className="p-4">16px padding</div>
<div className="px-6 py-3">24px horizontal, 12px vertical</div>

// Margin
<div className="mt-8 mb-4">32px top, 16px bottom</div>

// Gap (flexbox/grid)
<div className="flex gap-3">12px gap between items</div>
<div className="grid gap-6">24px grid gap</div>

Guidelines

  • Component internal padding: Use p-3 (12px) to p-6 (24px) depending on density
  • Section spacing: Use space-y-8 (32px) or space-y-12 (48px) between major sections
  • Inline spacing: Use gap-2 (8px) to gap-4 (16px) between related inline elements
  • Never use arbitrary spacing values — always snap to the 4px grid

On this page