Spacing & radius

A 4px spacing grid, four control heights, five radius tiers and three elevation steps.

Spacing

Tailwind's default 4px grid (p-1 = 4px). Use the scale steps below; avoid arbitrary values such as p-[3px].

1
4px
1.5
6px
2
8px
3
12px
4
16px
5
20px
6
24px
8
32px
10
40px
12
48px
  • Inside controls: gap-1.5 between icon and label, px-2.5.
  • Inside cards and sheets: p-4; between stacked fields: gap-4.
  • Between page sections: mb-12; page header: py-10.

Control sizes and density

The system is compact by default (32px controls). That meets WCAG 2.2 AA target size (24px). On touch-first screens use the lg size, or add pointer-coarse:h-10 to raise targets toward 44px for coarse pointers only.

size="xs"h-6 · 24pxDense toolbars, inline table actions
size="sm"h-7 · 28pxSecondary actions, filters
size="default"h-8 · 32pxButtons, inputs, menu triggers
size="lg"h-9 · 36pxPrimary page actions, touch-first screens

Radius

Every tier is derived from --radius (0.5rem = the lg tier), so changing that one value rescales the whole system. Pick the tier by component role, not by size.

rounded-sm

Small inner details (kbd, checkbox)

rounded-md

Inner items: menu items, tab triggers, tooltips

rounded-lg

Controls: buttons, inputs, menu and popover panels

rounded-xl

Containers: cards, dialogs, inset panels

rounded-full

Avatars, pill badges, status dots

Nested corners: an inner element's radius should be one tier below its container (a rounded-md item inside a rounded-lg menu).

Elevation

Three steps. In dark mode shadows are hard to see, so elevation comes from surface lightness first (background → card → popover) and the shadow only reinforces it. Cards rest flat with a border; they get no shadow.

shadow-sm

Raised in place: active tab, inset panel

shadow-md

Floating: dropdown menus, popovers, tooltips

shadow-lg

Overlays: sheets, dialogs, toasts

Layers (z-index)

Only three values are used. Don't add new ones; portal the element instead.

z-10Sticky elements inside the page (desktop sidebar, avatar badge)
z-20Sidebar rail
z-50Portalled layers: menus, tooltips, sheets and their overlay. Later-opened layers sit on top by DOM order.