DS0
Foundations

Spacing

DS0 uses a 4px base unit spacing scale for consistent layouts across all components.

Philosophy

All spacing in DS0 is based on a 4px grid. Every margin, padding, and gap aligns to multiples of 4px, creating visual rhythm and consistency.

Scale

0
0px
Px
1px
05
2px
1
4px
15
6px
2
8px
25
10px
3
12px
35
14px
4
16px
5
20px
6
24px
7
28px
8
32px
9
36px
10
40px
11
44px
12
48px
14
56px
16
64px
20
80px
24
96px
28
112px
32
128px
36
144px
40
160px
44
176px
48
192px
52
208px
56
224px
60
240px
64
256px
72
288px
80
320px
96
384px

Usage

// Tailwind utility classes map to spacing tokens
<div className="p-4">16px padding</div>
<div className="gap-3">12px gap</div>
<div className="mt-6">24px top margin</div>

// Spacing tokens are also available as CSS variables
.custom {
  padding: var(--ds0-spacing-4); /* 16px */
  gap: var(--ds0-spacing-3); /* 12px */
}

Density Modes

DS0 supports three density modes for different contexts:

ModePadding XPadding YGapBest For
Compact8px4px6pxData-dense UIs, dashboards
Comfortable16px8px8pxDefault — most applications
Spacious24px12px12pxMarketing, landing pages
// Apply density via data attribute
<div data-density="compact">Dense layout</div>
<div data-density="spacious">Airy layout</div>

On this page