search⌘K

Spacing

Commure UI's spacing system is built on a 4px base unit, scaled through consistent multiples. This ensures predictable rhythm, clean alignment, and visual harmony across all layouts.

Figma

Scale

The Commure UI spacing scale is built on a 4px base unit. All values are multiples of 4, ensuring predictable rhythm and clean alignment across layouts.

TokenpxVisualUsage
14
Icon gaps, tight padding inside chips/tags
28
Inline element gaps, compact list item padding
312
Input padding, small button padding
416
Default content padding, card inner padding
520
Section gaps within a component
624
Card padding, modal inner padding
832
Between related sections on a page
1040
Section separators, table row height
1248
Page gutter padding
1664
Large section gaps, hero spacing
2080
Top-level page regions

Named tokens

Named aliases map readable labels to specific scale values. Use these in components to express intent rather than hardcoded pixel values.

TokenpxVisualUsage
xsmall8
Inline gaps, compact component internals
small12
Button padding, input inner padding
normal16
Default gap between sibling elements
gutter20
Component-level gutter between sections
medium24
Card padding, dialog padding
large32
Between related page sections
xlarge48
Page-level gutter, top-of-content breathing room

Best Practices

Do

  • •Always use tokens from the scale — never hardcode pixel values.
  • •Use named tokens (small, normal, large) to express semantic intent in components.
  • •Keep structure neutral — use spacing for grouping, not for visual decoration.
  • •Scale up (large, xlarge) for page-level regions; scale down (xsmall, small) inside dense components.

Don't

  • •Don't use arbitrary px values that fall outside the 4px grid.
  • •Don't mix scale tokens and hardcoded values in the same component.
  • •Don't use spacing tokens to compensate for missing alignment — fix layout structure instead.

FAQs

Q. Why use a 4px grid?

A. 4px aligns with device pixel densities and provides consistent vertical rhythm across all component densities.

Q. Can I use custom pixel values?

A. No. Always use existing tokens to maintain consistency and predictability of rhythm.

Q. How does spacing relate to typography?

A. Line spacing and flow text root proportionally to the scale. Use normal (16px) as the baseline gap between text and UI elements.