Spacing

Spacing is a powerful tool that determines how elements are positioned relative to each other and emphasizes certain elements while de-emphasizing others. Consistent spacing enhances visual appeal and guides the user's journey through the content. Space relates to size and visual consistency through alignment of baselines, gutters, padding, margins etc.

While Salt provides a general approach to spacing, it isn’t an exhaustive set of guidelines.

The design system uses the same spatial tokens for both spacing. Consistent application of these tokens helps align layouts, establish a uniform visual rhythm, and enhance the overall visual appeal of your application's design.

The Salt spacing system is structured around a base unit of --salt-spacing-100 for each density, with a scale that is proportional across all densities. Every space token within the system is a multiple of --salt-spacing-100 and percentages of the base unit. This scale ensures consistency and flexibility with predictable values that adjust both upward and downward.

TokenFormulaHigh Density (HD) (px)Medium Density (MD) (px)Low Density (LD) (px)Touch Density (TD) (px)
--salt-spacing-250.25x1234
--salt-spacing-500.50x2468
--salt-spacing-750.75x36912
--salt-spacing-1001.00x481216
--salt-spacing-1501.50x6121824
--salt-spacing-2002.00x8162432
--salt-spacing-2502.50x10203040
--salt-spacing-3003.00x12243648
--salt-spacing-3503.50x14284256
--salt-spacing-4004.00x16324864
--salt-spacing-4504.50x18365472
--salt-spacing-5005.00x20406080
--salt-spacing-5505.50x22446688
--salt-spacing-6006.00x24487296
--salt-spacing-6506.50x265278104
--salt-spacing-7007.00x285684112
--salt-spacing-7507.50x306090120
--salt-spacing-8008.00x326496128
--salt-spacing-8508.50x3468102136
--salt-spacing-9009.00x3672108144
--salt-spacing-9509.50x3876114152

Spacing is a powerful tool to emphasize certain elements while de-emphasizing others, guiding the user's journey through the content. Salt recommends using varied spacing (--salt-spacing-300, --salt-spacing-200, --salt-spacing-100) between elements to establish a visual hierarchy. The vertical separation of items such as headings, blocks of text, form elements and cards should follow a consistent pattern to create visual rhythm.

Horizontal dividers are used to divide regions of a layout and should be spaced consistently with salt-spacing-300 above and below sections. For more information on dividers, please refer to the divider component page.

Side by side example of hierarchical spacing with and without a divider.

Headings serve as the primary title for different content types by providing visual separation and hierarchy. All headings should be accompanied by standard spacing above and below. The spacing placed directly below a heading depends on the level of focus placed on the item.

To find out more about how to use spacing in headers, please refer to the forms pattern page.

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

A container represents an enclosed area with information, this is typically anything that is in a div in code. Padding is the space inside a given area, controlling the distance between its content and boundary. Padding in containers varies depending on the container size.

Please refer to the header block pattern page to learn more about container padding in context.

Container sizePadding size
Large--salt-spacing-300
Medium--salt-spacing-200
Small--salt-spacing-100

Horizontal spacing between items can vary depending on relationship and context.

Standard spacing between items in a form is typically --salt-spacing-300, which aligns with the design systems responsive layout grid, and automatically will adjust depending on what density you use.

Horizontal spacingSpace between
Buttons--salt-spacing-100
Components--salt-spacing-300
Diagram of what spacing between components should look like.

Standard spacing between related items, such as buttons in a button bar group, is typically --salt-spacing-100.

Diagram of what spacing between buttons should look like.

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