Skip to main content Skip to docs navigation

Space Tokens

Comprehensive guide to spacing tokens defining consistent margins, padding, and gaps throughout the design system.

This documentation is a work in progress. Some information may be incomplete, outdated, or differ from the current product behavior.

Overview

Space tokens define consistent spacing values for margins, padding, gaps, and other whitespace throughout the design system. They create visual rhythm, improve readability, and ensure harmonious relationships between interface elements.

Architecture

Space tokens follow a two-layer architecture where foundational spacing values are defined in the metric-base token set and then applied through contextual and component-specific tokens in the App group.

How it works:

The system provides progressive specificity:

  1. Base spacing (space.unit.*) defines raw spacing values using an 8-point grid
  2. Contextual spacing (space.context.*) provides semantic spacing scales (xsmall, small, medium, large)
  3. Component spacing (space.[component].*) assigns specific spacing to component parts (padding-x, padding-y, gap)

Benefits:

  • Consistent spacing scale across all components
  • Predictable visual rhythm through systematic increments
  • Easy to adjust component spacing globally
  • Semantic naming clarifies spacing intent

Spacing tokens share the same underlying dimensional values as size tokens but are semantically distinct—size tokens define element dimensions while space tokens define the whitespace between and around elements.

Organization

Space tokens are organized into three categories:

Base Spacing: Raw spacing values in pixels, primarily using an 8-point grid system.

Contextual Spacing: Semantic spacing scales from zero through 6xlarge for flexible application.

Component Spacing: Specific padding, gap, and margin values for individual UI components.

This organization balances precision with usability.

Base Spacing

Base spacing tokens provide foundational whitespace values following an 8-point grid system.

Standard Spacing Scale

Token NameValue (px)Visual ScaleUse Cases
space.unit.00NoneNo spacing, zero margin
space.unit.11MinimalSeparator lines
space.unit.22TinyVery tight spacing
space.unit.44Extra smallCompact layouts
space.unit.88SmallBase grid unit
space.unit.1212Small-mediumTight padding
space.unit.1616MediumStandard spacing
space.unit.2020Medium-largeComfortable spacing
space.unit.2424LargeGenerous padding
space.unit.2828Large+Extra padding
space.unit.3232Extra largeSection spacing
space.unit.3636Extra large+Large gaps
space.unit.40402x largeGenerous sections
space.unit.48483x largeMajor spacing
space.unit.56564x largeLarge sections
space.unit.64645x largeHero spacing
space.unit.72726x largeExtra large sections
space.unit.80807x largeMaximum spacing
space.unit.96968x largeExtreme spacing
space.unit.12012010x largePage-level spacing

Special Spacing Values

Token NameValuePurpose
space.unit.050.5pxHalf-pixel adjustments
space.unit.d050.05emRelative fractional spacing
space.unit.d151.5px1.5-pixel spacing
space.unit.d252.5px2.5-pixel spacing
space.unit.n1 through space.unit.n8Negative valuesNegative margins, overlaps

Contextual Spacing

Contextual spacing tokens provide semantic spacing values with clear sizing hierarchy.

Token NameValue (px)Purpose
space.context.zero0No spacing
space.context.4xsmall1Minimal separation
space.context.3xsmall2Very tight spacing
space.context.2xsmall4Extra tight spacing
space.context.xsmall8Tight spacing, compact layouts
space.context.small12Small spacing, close elements
space.context.medium16Standard spacing, default gaps
space.context.large20Comfortable spacing
space.context.xlarge24Generous spacing
space.context.2xlarge28Extra generous spacing
space.context.3xlarge32Large spacing between sections
space.context.4xlarge36Extra large section spacing
space.context.5xlarge40Maximum regular spacing
space.context.6xlarge48Hero-level spacing

Spacing Hierarchy

The contextual spacing scale follows a logical progression:

  • Micro spacing (4xsmall - 2xsmall): 1-4px for tight, compact layouts
  • Component spacing (xsmall - medium): 8-16px for within-component spacing
  • Group spacing (large - xlarge): 20-24px for related element groups
  • Section spacing (2xlarge - 4xlarge): 28-36px for distinct sections
  • Page spacing (5xlarge - 6xlarge): 40-48px for major page divisions

Component Spacing

Component-specific spacing tokens define padding, gaps, and margins for individual UI elements.

Button Spacing

Token NameValueApplied To
space.button.small-padding-y6pxSmall button vertical padding
space.button.small-padding-x8pxSmall button horizontal padding
space.button.small-gap4pxGap between icon and text (small)
space.button.medium-padding-y8pxMedium button vertical padding
space.button.medium-padding-x12pxMedium button horizontal padding
space.button.medium-gap8pxGap between icon and text (medium)
space.button.large-padding-y10pxLarge button vertical padding
space.button.large-padding-x16pxLarge button horizontal padding
space.button.large-gap12pxGap between icon and text (large)

Form Input Spacing

Token NameValueApplied To
space.form-input.small-padding-y6pxSmall input vertical padding
space.form-input.small-padding-x8pxSmall input horizontal padding
space.form-input.small-gap8pxGap in small inputs
space.form-input.medium-padding-y8pxMedium input vertical padding
space.form-input.medium-padding-x12pxMedium input horizontal padding
space.form-input.medium-gap12pxGap in medium inputs
space.form-input.large-padding-y10pxLarge input vertical padding
space.form-input.large-padding-x16pxLarge input horizontal padding
space.form-input.large-gap16pxGap in large inputs

Badge & Chip Spacing

Token NameValueApplied To
space.badge.small-padding-y1pxSmall badge vertical padding
space.badge.small-padding-x4pxSmall badge horizontal padding
space.badge.medium-padding-y2pxMedium badge vertical padding
space.badge.medium-padding-x4pxMedium badge horizontal padding
space.chip.medium-padding-y4pxMedium chip vertical padding
space.chip.medium-padding-x4pxMedium chip horizontal padding
space.chip.medium-gap8pxGap in medium chips

Card & Modal Spacing

Token NameValueApplied To
space.modal.small-padding-y16pxSmall modal vertical padding
space.modal.small-padding-x16pxSmall modal horizontal padding
space.modal.small-gap16pxGap in small modals
space.modal.medium-padding-y24pxMedium modal vertical padding
space.modal.medium-padding-x24pxMedium modal horizontal padding
space.modal.medium-gap24pxGap in medium modals
space.modal.large-padding-y32pxLarge modal vertical padding
space.modal.large-padding-x32pxLarge modal horizontal padding
space.modal.large-gap32pxGap in large modals

Page Spacing

Token NameValueApplied To
space.page.small-padding-y16pxSmall page vertical padding
space.page.small-padding-x16pxSmall page horizontal padding
space.page.medium-padding-y24pxMedium page vertical padding
space.page.medium-padding-x24pxMedium page horizontal padding
space.page.large-padding-y32pxLarge page vertical padding
space.page.large-padding-x32pxLarge page horizontal padding

List & Table Spacing

Token NameValueApplied To
space.list.padding-y12pxList item vertical padding
space.list.padding-x16pxList item horizontal padding
space.list.gap16pxGap between list elements
space.table.cell-padding-y8pxTable cell vertical padding
space.table.cell-padding-x8pxTable cell horizontal padding
space.table.cell-gap8pxGap in table cells

Usage Guidelines

Choosing the Right Token

For components: Use component-specific tokens (space.button.*, space.form-input.*)

For flexible spacing: Use contextual tokens (space.context.*)

For custom spacing: Use base tokens (space.unit.*)

Design Principles

8-Point Grid: Base all spacing on multiples of 8px for visual consistency

Progressive Spacing: Larger elements should have proportionally more spacing

Breathing Room: Ensure sufficient whitespace around interactive elements

Visual Grouping: Use consistent spacing to indicate related elements

Spacing Scale Selection

Micro content (labels, badges): 4-8px (xsmall)

Component internals (button padding): 8-16px (small-medium)

Element groups (form fields): 16-24px (medium-large)

Sections: 24-40px (xlarge-5xlarge)

Page divisions: 40-64px (5xlarge-6xlarge)

Accessibility

  • Ensure sufficient spacing between interactive elements (minimum 8px)
  • Provide adequate padding for touch targets (minimum 8px around 32px target)
  • Use consistent spacing to indicate relationships and hierarchy
  • Test spacing with actual content to avoid cramped layouts

Best Practices

Do:

  • Use contextual spacing tokens for semantic, flexible layouts
  • Maintain consistent spacing for similar elements
  • Stick to the 8-point grid whenever possible
  • Use component tokens for specific UI elements
  • Increase spacing proportionally with element size

Don't:

  • Use arbitrary spacing values—always reference tokens
  • Mix different spacing systems inconsistently
  • Use spacing smaller than 4px for visible gaps
  • Ignore the 8-point grid without good reason
  • Use negative spacing except for intentional overlaps

Common Patterns

Stack Spacing: Use space.context.medium (16px) between stacked elements

Inline Spacing: Use space.context.small (12px) or space.context.xsmall (8px) for inline gaps

Section Spacing: Use space.context.3xlarge (32px) or larger for distinct sections

Component Padding: Use component-specific tokens for consistent internal spacing