Menu


The distances inside and between things, from a control's padding to the rhythm between sections of a page.

Primitive and semantic tokensChanges with densityChanges with viewport

Spacing scale


  1. 00px
  2. 22px
  3. 44px
  4. 66px
  5. 88px
  6. 1212px
  7. 1616px
  8. 2020px
  9. 2424px
  10. 3232px
  11. 4040px
  12. 4848px
  13. 5656px
  14. 6464px
  15. 7272px
  16. 9696px
  17. 128128px

Guidelines


Purpose

The vocabulary of distances: padding inside things, gaps between things, and the rhythm between sections of a page. It is dense at the small end, where a few pixels change how a control feels, and coarser at the large end, where the eye reads rhythm rather than measurement.

How it is structured

The primitive scale is a run of steps named by their size. The steps sit close together at the small end and grow further apart toward the large end. Nothing about a step says what it is for; it is a length and nothing else.

The semantic layer names the kind of distance, which is the thing that changes with density:

  • Inset — padding inside a thing: a button, a card, a field.
  • Stack — the gap between things arranged vertically.
  • Inline — the gap between things arranged horizontally.
  • Section — the vertical rhythm between sections of a page.
  • Gutter — the breathing room at a section's inline edges.
  • Layout — the spacing of a page's sections: their padding, the gap under a section's heading, the gaps between blocks and the gap of a grid.
  • Text — the gap between texts: paragraph to paragraph, a heading to its text, a caption under its title, one list item to the next. Text is not trimmed, so these are set for the full line box.
  • Link underline — the gap between a link's words and the line under them. It is the same in every density, because the line belongs to the words and not to the layout.

Each kind has its own run of sizes, and the runs are not the same length. Inline distances stop earlier than stack distances because things side by side never need the breathing room that stacked sections do. Component spacing is named by role, so that a density change can move a coherent set of decisions rather than every number at once.

The gutter is a section's own breathing room at its sides, not a page gutter. How close a page's content sits to the screen's edge is not part of the system: each site chooses its own page gutter.

Tiers

Both tiers reach CSS. A component's fixed internal distance — the gap between an icon and its label inside a button, the padding of a chip — may use a primitive step directly, because that distance does not change with theme, density or viewport, and forcing a named role onto every one of them would make a semantic layer of single-use entries with no meaning.

The semantic roles are mandatory for any distance that does change with context. If a distance ought to be tighter under compact density, it must be a semantic role, because a primitive has one value and nothing can re-point it.

Context behavior

Density changes the semantic roles and nothing else. Under compact density each role steps down one or more primitive steps. The smallest inset does not shrink, because it cannot become smaller and still be an inset; the largest section rhythm shrinks the most.

Density is chosen once by the person building a project and set as an attribute on the page element. It is never a reader-facing control and never follows the viewport. A Table is the one part of a page that can differ: it can take compact on its own in a comfortable page.

The layout and text roles are the one part of spacing that follows the screen: each has a phone value and a desktop value, which switch at the layout breakpoint, as the components' narrow and wide forms do, and either can be forced on any part of a page with the layout attribute. Each value is itself one of the roles above, so it still follows density.

Theme and text size do not touch spacing.

Usage rules

Do

  • Use a spacing token for every padding, margin, gap and structural offset. The conformance checker rejects a bare length in those properties.
  • Use the semantic role that names the kind of distance — inset for padding, stack for vertical gaps, inline for horizontal gaps, section for page rhythm — whenever the distance should follow density.
  • Use a primitive step for a fixed internal distance that should look the same under both densities.
  • Compose with calc() from existing steps when a distance genuinely falls between them, rather than writing the result as a number.

Don't

  • Write a pixel or rem length in component CSS or in a site built on the system. The conformance checker rejects it.
  • Create a mobile-suffixed or dark-suffixed spacing token. Context changes a value, never a name.
  • Use a section rhythm inside a component. Section distances are the page's; a component that needs that much space is probably a section.
  • Use a viewport media query to change a spacing value. If a distance should change with available width, use a container query, and reach for it only when the semantic roles cannot express the need.

Tokens


65 tokens in 9 groups. Open a group to see its tokens. The button beside a CSS name copies it, ready to paste; open a row for what the token is for and which components read it.

Scaleprimitive · 17 tokens
Spacing tokens: Scale
TokenValuePictureCSS
00px--smbk-space-0
22px--smbk-space-2
44px--smbk-space-4
66px--smbk-space-6
88px--smbk-space-8
1212px--smbk-space-12
1616px--smbk-space-16
2020px--smbk-space-20
2424px--smbk-space-24
3232px--smbk-space-32
4040px--smbk-space-40
4848px--smbk-space-48
5656px--smbk-space-56
6464px--smbk-space-64
7272px--smbk-space-72
9696px--smbk-space-96
128128px--smbk-space-128
Insetsemantic · 8 tokens
Spacing tokens: Inset
TokenComfortableCompactPictureCSS
2xs2px2px--smbk-space-inset-2xs
xs4px4px--smbk-space-inset-xs
sm6px4px--smbk-space-inset-sm
md8px6px--smbk-space-inset-md
lg12px8px--smbk-space-inset-lg
xl16px12px--smbk-space-inset-xl
2xl24px16px--smbk-space-inset-2xl
3xl32px24px--smbk-space-inset-3xl
Stacksemantic · 9 tokens
Spacing tokens: Stack
TokenComfortableCompactPictureCSS
xs4px4px--smbk-space-stack-xs
sm8px6px--smbk-space-stack-sm
md12px8px--smbk-space-stack-md
lg16px12px--smbk-space-stack-lg
xl24px16px--smbk-space-stack-xl
2xl32px24px--smbk-space-stack-2xl
3xl40px32px--smbk-space-stack-3xl
4xl48px40px--smbk-space-stack-4xl
5xl56px48px--smbk-space-stack-5xl
Inlinesemantic · 7 tokens
Spacing tokens: Inline
TokenComfortableCompactPictureCSS
xs4px4px--smbk-space-inline-xs
sm6px4px--smbk-space-inline-sm
md8px6px--smbk-space-inline-md
lg12px8px--smbk-space-inline-lg
xl16px12px--smbk-space-inline-xl
2xl24px16px--smbk-space-inline-2xl
3xl32px24px--smbk-space-inline-3xl
Guttersemantic · 2 tokens
Spacing tokens: Gutter
TokenComfortableCompactPictureCSS
xs8px4px--smbk-space-gutter-xs
sm12px8px--smbk-space-gutter-sm
Sectionsemantic · 4 tokens
Spacing tokens: Section
TokenComfortableCompactPictureCSS
sm48px32px--smbk-space-section-sm
md64px48px--smbk-space-section-md
lg96px64px--smbk-space-section-lg
xl128px96px--smbk-space-section-xl
Layoutsemantic · 11 tokens
Spacing tokens: Layout
TokenPhoneDesktopComfortableCompactPictureCSS
guttercomfortable: 8px · compact: 4pxcomfortable: 12px · compact: 8pxundefinedundefined--smbk-space-layout-gutter
section.xscomfortable: 16px · compact: 12pxcomfortable: 24px · compact: 16pxundefinedundefined--smbk-space-layout-section-xs
section.smcomfortable: 32px · compact: 24pxcomfortable: 48px · compact: 32pxundefinedundefined--smbk-space-layout-section-sm
section.mdcomfortable: 64px · compact: 48pxcomfortable: 96px · compact: 64pxundefinedundefined--smbk-space-layout-section-md
section.lgcomfortable: 64px · compact: 48pxcomfortable: 128px · compact: 96pxundefinedundefined--smbk-space-layout-section-lg
insetcomfortable: 16px · compact: 12pxcomfortable: 32px · compact: 24pxundefinedundefined--smbk-space-layout-inset
headingcomfortable: 40px · compact: 32pxcomfortable: 56px · compact: 48pxundefinedundefined--smbk-space-layout-heading
gap.mdundefinedundefined32px24px--smbk-space-layout-gap-md
gap.lgcomfortable: 32px · compact: 24pxcomfortable: 48px · compact: 40pxundefinedundefined--smbk-space-layout-gap-lg
panelcomfortable: 24px · compact: 16pxcomfortable: 48px · compact: 40pxundefinedundefined--smbk-space-layout-panel
grid.gapcomfortable: 16px · compact: 12pxcomfortable: 24px · compact: 16pxundefinedundefined--smbk-space-layout-grid-gap
Textsemantic · 6 tokens
Spacing tokens: Text
TokenPhoneDesktopComfortableCompactPictureCSS
headingcomfortable: 12px · compact: 8pxcomfortable: 16px · compact: 12pxundefinedundefined--smbk-space-text-heading
caption4px8pxundefinedundefined--smbk-space-text-caption
sectioncomfortable: 24px · compact: 16pxcomfortable: 32px · compact: 24pxundefinedundefined--smbk-space-text-section
paragraphundefinedundefined16px12px--smbk-space-text-paragraph
listundefinedundefined8px6px--smbk-space-text-list
label0px0px0px0px--smbk-space-text-label
Other spacing tokenssemantic · 1 token
Spacing tokens: Other spacing tokens
TokenValuePictureCSS
link-underline4px--smbk-space-link-underline