Skip to main content
Styles

Spacing

Draft

Arch UI leverages standard sizes and spacing created from increments of 4. This provides consistent sizing and components that snap into place.

16
24
36
48
64

Common alternative names

Spacers, sizing units


Anatomy

Spacing interval

We use an incremental spacing scale with a root of 4 based on a modular scale with a major second ratio (1.125).

All grids, typography, and component constructions leverage this scale to produce a pixel-fitted and harmonious structure. Use this scale to create space between objects in product layouts.

16Core sizes
4
8
12
16
20
24
28
32
36
40
48
56
64
96
128
Units1   2   3   4   5x   6x   7x   8x   9x   10x   12x   14x   16x   24x   32x

Baseline grid

Built off the 4 spacing scale, the vertical grid provides a flexible structure that allows text to flow vertically along its baseline. This creates a consistent vertical rhythm across all product screens. Use multiples of 4 when defining measurements, spacing, and positioning elements.


Core sizes

While all increments of 4 are available, designers will use a set of five archetype sizes that will cover 90% of their layouts.

Note that not every asset should be displayed in all sizes. We don't show an xsmall avatar in this example, as its readability would be compromised.

64
48
36
24
16

Usage

Padding vs margin

Use padding to create space inside a container — the breathing room around content. Use margin (or gap) to create space between sibling elements. In Arch UI components, prefer CSS gap on flex and grid containers over margin; it avoids collapsed-margin surprises and is easier to override with a single token.


Component spacing

Semantic component tokens (--spacing-component-*) control the internal padding and gaps of individual components — buttons, inputs, cards, and dialogs. They follow a t-shirt size progression:

TokenValueTypical use
--spacing-component-xs4 pxTight icon padding, badge insets
--spacing-component-sm8 pxCompact button padding, input padding-inline
--spacing-component-md12 pxDefault internal padding
--spacing-component-lg16 pxCard body padding, dialog content area
--spacing-component-xl24 pxLarge cards, hero sections inside components

Inline spacing

Inline tokens (--spacing-inline-*) handle the horizontal gaps between elements that sit on the same line — icon + label, avatar + name, tag + tag.

TokenValueTypical use
--spacing-inline-xs2 pxSub-pixel optical gaps
--spacing-inline-sm4 pxIcon-to-label gap (small)
--spacing-inline-md8 pxIcon-to-label gap (default), chip gap
--spacing-inline-lg12 pxAdjacent buttons, wider inline groups

Layout spacing

Layout tokens control page-level structure — the gutter around content, the gap between major sections, and the gap between content blocks within a section.

TokenValueTypical use
--spacing-layout-page-gutter16 pxLeft/right page margin on mobile-first layouts
--spacing-layout-content-gap24 pxGap between content blocks within a section
--spacing-layout-section-gap48 pxGap between major page sections

Phone layout

All mobile devices, both Android and iOS, follow the same grid system. The only variable height will be the status bar, which changes depending on OS and device.

iOSAndroid
Status bar heightVariable by deviceVariable by device
Nav bar height4448
Left & right margin1616
Artwork column (centered in)6464

Do / Don't

padding: var(--spacing-component-md);
✓ Do

Use semantic tokens for component and layout spacing. They communicate intent and can be changed globally.

padding: 12px;
✕ Don't

Hardcoded pixel values bypass the system and won't respond to future density changes.

gap: var(--spacing-inline-md);
✓ Do

Use CSS gap with a spacing token on flex or grid parents to space children evenly.

.child { margin-right: 8px; }
✕ Don't

Adding margin to individual children creates inconsistencies and requires overrides on first or last child.

/* optical alignment override */ margin-top: var(--spacing-2);
✓ Do

Reach for primitive tokens only when no semantic token fits. Document why in a comment.

padding: var(--spacing-12);
✕ Don't

Don't use primitives for common patterns that already have semantic tokens. It hides the purpose of the value.