Spacer

Spacing is an important — and often overlooked — part of product design. D-system provides tokens and other utilities to take the guesswork out of spacing and help deliver clear, functional layouts

Introduction

Spacing is the negative area between elements and components. It is commonly controlled in code with margin and padding. D-system offers several methods such as tokens and layout components to make implementing spacing in its products easier and more consistent.

Spacing

The D-system spacing scale complements the 2x Grid and typography scale by using using multiples of two, four, and eight. It includes both small increments needed to create appropriate spatial relationships for detail-level designs as well as larger increments used to control the density of a design. Each level of the spacing scale has its own token. Spacing tokens can be used inside of components for building and between components for layout spacing.

Spacing scale

Use the spacing scale when building individual components. It includes small increments needed to create appropriate spatial relationships for detail-level designs. This scale is applied and used within all Depot components.

Applying spacing

The spacing scale can be applied to margin or padding properties, as well as to both vertical and horizontal edges. The values normally assigned to margin and padding. The following are all approved ways to syntactically apply Depot spacing using REMs.

Example
Token
rem (build)
px (design)
Usage
s2
0.125
2

Base; between text and labels

s4
0.25
4

Base; between list-items/xs-icon and text

s8
0.5
8

Between list/menu items; between checkbox and label; between icon and text

s12
0.75
12

DEFAULT.
Padding inside inputs; padding between margin and contents

s16
1
16

Between text elements or elements on a page

s24
1.5
24

Between inputs in forms

s32
2
32

--

s40
2.5
40

--

s48
3
48

--

s64
4
64

Between sections categories

s80
5
80

Between sections

s96
6
96

Between super sections

Example:

Lorem ipsum

Lorem ipsum dolor sit amet

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Stacking

The below example uses s8 for equal spacing.

Spacers are not responsive.

The Spacers themselves do not change values based on the screen size. However, it is acceptable at page breakpoints to jump a step(s) on the spacing scale to fit spacing needs (i.e., at 1440 px padding-right: s16 but at breakpoint 768px padding-right: s12).

Designing with space

Every part of a UI should be intentional including the empty space between elements. The amount of space between items creates relationships and hierarchy.

Creating relationships

Elements in a design that are near each other are seen as being meaningfully related. As more space is added between elements, their perceived relationship weakens.

Patterns created through spacing can also create relationships. Elements arranged in the same spacing pattern are seen as related pieces that have equal weight.

Space can also be used to denote groups of associated information. This creates content sections on a page without having to use lines or other graphical elements as a divider.

Creating hierarchy

Elements that have more spacing around them tend to be perceived as higher in importance than elements that have less space around them. Take this page for instance. The top level headers have more space surrounding them giving them focus and prominence. Then as the headers descend in importance they receive less space, signaling they are subordinate.

Elements that are set close to each other can be easily overlooked. Users may see the grouping but not process each individual item. Therefore, if you have an element or content of high importance on the page, consider giving it extra surrounding space to help it attract focus.

White space

Empty space — also known as white space — is important in design. It can be used to break up sections on a page or to help create focus on certain element(s). White space helps with information processing; too much dense information can be disorienting or overwhelming for a user. Sections of a UI are allowed to be dense, but the whole page should not be crowded; there should be white space to let the user’s eye rest.