• Docs
  • Components
  • Blocks
  • Admin
CtrlK
Get Started
  • Introduction
  • Setup
  • CLI
  • VS Code Extension
  • Figma Code Connect
  • MCP Server
  • llms.txt
  • Changelog
Foundations
  • Design Tokens
  • Theming & Modes
  • Semantic Colors
  • Spacing
  • Typography
Testing
  • Test Guide
  • Performance Tests
  • Visual Regression
Components
  • Accordion
  • Activity Feed
  • Alert
  • Avatar
  • Badge
  • Breadcrumbs
  • Button
  • Card
  • Carousel
  • Checkbox
  • Collapsible
  • Combobox
  • Command Palette
  • Context Menu
  • Date Picker
  • Dialog
  • Dropdown Menu
  • File Upload
  • Hover Card
  • Input
  • Kbd
  • Label
  • Menubar
  • Metric Card
  • Multi Select
  • Navigation Menu
  • Pagination
  • Popover
  • Progress
  • Quick Actions
  • Radio
  • Rating
  • Resizable
  • Segmented Control
  • Select
  • Separator
  • Sheet
  • Skeleton
  • Slider
  • Spinner
  • Split Button
  • Stepper
  • Switch
  • Table
  • Tabs
  • Tag Input
  • Textarea
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Tree View
Blocks
  • Activity Feed
  • App Shell
  • Authentication Block
  • Benefits Section
  • Cta Section
  • Data Table
  • Empty State
  • Faq Section
  • Feature Grid Section
  • Footer Section
  • Hero Section
  • Kpi Dashboard
  • Kpi Strip
  • Link Card
  • Metric Card
  • Navigation Header
  • Pagination Footer
  • Pricing Table
  • Quick Actions
  • Settings Screen
Resources
  • API Reference
Semantic ColorsTypography

Spacing

Spacing tokens for consistent layout and rhythm across the design system.

Spacing Scale

The spacing scale provides values from 0 to 32px in increments that follow a logical progression:

--space-00px
Visual representation
--space-14px
Visual representation
--space-28px
Visual representation
--space-312px
Visual representation
--space-416px
Visual representation
--space-624px
Visual representation
--space-832px
Visual representation

Usage Examples

Here are practical examples of how to use spacing tokens in your components:

Padding Examples

Small padding (space-2 = 8px)

Content

Medium padding (space-4 = 16px)

Content

Large padding (space-8 = 32px)

Content

Gap Examples

Small gap (space-2 = 8px)

Item 1
Item 2
Item 3

Medium gap (space-4 = 16px)

Item 1
Item 2
Item 3

Large gap (space-6 = 24px)

Item 1
Item 2
Item 3

Margin Examples

Stacked elements with margin (space-4 = 16px)

Card 1
Card 2
Card 3

Interactive Tool

Use the interactive tool below to test different spacing values and see how they affect component layouts:

Padding: var(--space-4)

Content with 16px padding

Gap: var(--space-4)

Item 1
Item 2
Item 3

Margin: var(--space-4)

Element with 16px margin

CSS Variables

All spacing values are available as CSS variables:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

Best Practices

  • Use spacing tokens consistently: Always use CSS variables instead of hardcoded pixel values
  • Follow the scale: Stick to the predefined spacing values (0, 1, 2, 3, 4, 6, 8) rather than arbitrary values
  • Maintain rhythm: Use consistent spacing throughout your application to create visual rhythm
  • Consider density: Adjust spacing based on density mode (compact, normal, comfortable)
  • Responsive spacing: Use smaller spacing values on mobile devices and larger values on desktop

Density Modes

Spacing can be adjusted based on density mode. See Density documentation for more details.

Semantic ColorsTypography