Spacing

The organization of space is a key aspect of design. Spatial tokens help align layouts and create consistent visual rhythm.

The spacing system is structured around a base unit (--salt-spacing-100) for each density. This token determines the scale used across the design system.

Every space token within the system is a multiple of --salt-spacing-100. The numerical suffix indicates the percentage of the base unit each token represents. The scale is proportional across all densities.

TokenFormulaHigh Density (HD)Medium Density (MD)Low Density (LD)Touch Density (TD)
--salt-spacing-250.25x1px2px3px4px
--salt-spacing-500.50x2px4px6px8px
--salt-spacing-750.75x3px6px9px12px
--salt-spacing-1001.00x4px8px12px16px
--salt-spacing-1501.50x6px12px18px24px
--salt-spacing-2002.00x8px16px24px32px
--salt-spacing-2502.50x10px20px30px40px
--salt-spacing-3003.00x12px24px36px48px
--salt-spacing-3503.50x14px28px42px56px
--salt-spacing-4004.00x16px32px48px64px

The vertical separation of items such as headings, blocks of text, form elements and cards should follow a consistent pattern to create visual rhythm throughout a layout.

Headings provide visual separation and help to establish hierarchy. All headings should be accompanied by standard spacing above and below. The amount of spacing should be based on the following:

  • Add salt-spacing-200 directly above the heading regardless of the level of heading.
  • The spacing placed directly below a heading depends on the level of focus placed on the following item.

When content directly following a header is a primary focus, for instance, the first paragraph of an article, the spacing between the header and the text is relative to the level of the heading. An H1 is followed by --salt-spacing-300, H2 by --salt-spacing-200, and H3 by --salt-spacing-100. For text accompanied by an H4, there is no spacing between the elements. Additionally:

  • Spacing after a section is consistently implemented using --salt-spacing-300 regardless of the heading level below.
  • Although the following example indicates each section as starting with a heading, this is not always required.
HeadingSpace aboveSpace below
H1--salt-spacing-200--salt-spacing-300
H2--salt-spacing-200--salt-spacing-200
H3--salt-spacing-200--salt-spacing-100
H4--salt-spacing-200None

When text following a header is a secondary focus, such as a section description intended as a supporting element to the section's content, spacing is a standard size regardless of the heading level. Keep the following in mind:

  • Headings followed by secondary focus text are consistently separated by --salt-spacing-100.
  • When a description follows a heading, the spacing is reduced to reinforce the relationship between the heading and description.
HeadingSpace aboveSpace below
H1--salt-spacing-200--salt-spacing-100
H2--salt-spacing-200--salt-spacing-100
H3--salt-spacing-200--salt-spacing-100
H4--salt-spacing-200--salt-spacing-100

For content following a heading that is not text, such as an image, form, card or data visualization, the spacing between the elements is treated consistently, as with non-hierarchical spacing. To clarify:

  • Anything that is not text is separated from its heading by --salt-spacing-300
  • Spacing above the header is maintained consistently at --salt-spacing-200

Maintaining consistent spacing between headings, text, content blocks and sections provides visual rhythm when managing large amounts of content. Note that:

  • Visual rhythm is maintained when elements repeat at regular intervals
  • Consistency and rhythm help people comprehend and navigate an interface more easily

Horizontal separators are used to divide regions of a layout, sections of content, or groups of components and/or data.

For spacing purposes, separators are considered to be a type of content and therefore spaced consistently. This means that:

  • Separators do not come with any pre-defined spacing of their own.
  • --salt-spacing-300 should appear above and below a separator between sections.

Only use separators if the content cannot be effectively divided in another way. Too many repeating lines can overload a design and create unnecessary visual noise.

The Division Foundation provides further guidance on the use of separators and their alternatives.

We appreciate your thoughts and feedback on any content in the Salt foundations. Please contact us if you have any comments or questions.