This library is still in development and is available only for internal usage at VTEX.
Skip to main content

Spacing

Spacing

Version: Next

Spacing

Spacing defines the relationship between elements and makes the content more easily scannable.

Values and examples​

The spacing scale uses multiples of 4px and offers a wide range of values. It was designed to be easily applied and to be able to distance both large and small elements.

During handoff, it's not necessary to specify spacing inside Admin UI components. To specify spacing elsewhere, use the utilities in the Admin UI – File Organization Figma library or the Measure Figma plugin.

Containers​

Container typePaddingExamples
WideHorizontal padding much larger than vertical padding.Tag
Page Header
NarrowVertical padding much larger than horizontal padding.Tabs
EvenThe same value for vertical and horizontal paddings.Card
Modal
OpticalHorizontal padding is slightly larger than vertical padding to account for the visual weight of the container.Alert
Toast

Actions​

Action sizeHeightExamples
SmallUp to 28px height.Selected option in a Combobox
MediumBetween 28px and 44px height.Normal Button
Normal Menu
Filter
Select Inline
LargeMore than 44px height.Large Button
Large Menu
Tab

Tokens​

TokenpxremExamples
$space-000Vertical space between:
β€’ $body Texts
β€’ $detail Texts (Input Field, Control Field)
$space-0520.125Vertical space between:
β€’ $body Text β†’ $detail Text (Control Field label and help text)
β€’ Label β†’ $body Text (Table cell with a 2 lines)
$space-140.25Vertical space between:
β€’ $title2 Text β†’ $body Text (Filter and Combobox empty states)
β€’ Label β†’ Input (Input Fields)
β€’ Input β†’ $detailText (Input Fields help or error texts)
$space-280.5Vertical space between:
β€’ Trigger β†’ Overlay (Date Picker, Combobox, Filter, Select Inline, Menu)
β€’ Label β†’ Tag Normal

Horizontal space between:
β€’ Control β†’$body Text (Checkbox, Radio)
β€’ Trigger β†’ Overlay (Filter, Select Inline, Menu, Combobox, Date Picker)
β€’ Icon β†’ Short text (Search, Combobox)
β€’ Medium Actions with a background (FilterBar)
β€’ Large Actions without a background (Tabs)
β€’ Short text β†’ Normal Action without background (Toast, Pagination)
$space-3120.75Vertical space between:
β€’ Control Fields β†’ $detail Text (Checkbox or Radio Group help text)

Horizontal space between:
β€’ $body Text β†’ Control Fields (Checkbox Group, Radio Group)
β€’ Icon β†’ Long Text (Toast, Alert)
β€’$pageTitle β†’ Tag Large (Page Header)
β€’ $title1 β†’ Tag Normal (Card, Modal)
β€’ $body Text β†’ Tertiary Button (Toast, Alert)
β€’ Small wide container, left and right paddings (Tag)
$space-4161Vertical space between:
β€’ Control Fields
β€’ Input Fields
β€’ Cards
β€’ Toolbars

Horizontal space between:
β€’ Input fields
β€’ Cards
$space-5201.25Horizontal space between:
β€’ Control fields
β€’ Toolbars (Data View Pagination and Actions)

Horizontal space:
β€’ Medium optical container (Alert and Toast padding-left and right)
$space-6241.5Vertical space between:
β€’ Section Header β†’ Section Content (Search and Table in DataView)
β€’ Section Content β†’ Section Footer (Table and Pagination in Data View)

Vertical space:
β€’ Large wide containers (Card Header and Footer, Modal Header and Footer top and bottom paddings)
$space-7281.75Vertical space:
β€’ Large optical containers (Card and Modal top and bottom paddings)
$space-8322Vertical and Horizontal space:
β€’ Large even containers (Card and Modal paddings)

Horizontal space:
β€’ Large wide containers (Card Header and Footer, Modal Header and Footer left and right paddings)
β€’ Large optical containers (Card and Modal left and right paddings)
$space-10402.5Vertical space:
β€’ Standard Pages margin-top
β€’ Vertical and Horizontal space:
β€’ Toast bottom and right margins
$space-12483Vertical space:
β€’ Wide Pages margin-bottom
β€’ Narrow Pages margin-top
$space-16644Vertical space between:
β€’ Form sections
$space-20805Vertical space:
β€’ Standard pages margin-bottom
$space-24966
$space-281127
$space-321288Vertical space:
β€’ Narrow pages margin-bottom

Principles​

The choice of which spacing value to use should be intentional, just like every other aspect of the user interface. Consider the following principles when designing with spacing:

Relationships and hierarchy​

Humans instinctively look for patterns, so it is important to keep the Gestalt principles in mind, such as similarity, proximity, continuity, closure and common region.

  • Elements that are meaningfully related should be closer to each other, for example, a Checkbox and its label.
  • Elements arranged in the same spacing pattern are usually perceived as having similar weight, for example, options in a Checkbox Group.
  • Spacing can also define the relationships between groups of elements. For example, the space between form sections should have a higher value than the space between the form section title and a field.
  • Elements with more spacing around them are usually perceived as having a higher relevance on the interface, for example, the spacing around an error state of a DataView.

Examples of spacing within a Checkbox group and between form sections.
Example of spacing around the error state in a DataView.

Visual rhythm​

The visual rhythm of an interface is defined by pattern repetition. Spacing is a valuable resource to create rhythm in a design, improving predictability, scannability and hierarchy. It also allows you to draw the user’s attention to specific points by intentionally breaking the pattern.

  • The rhythm can be more predictable when elements within a screen have the same level of importance, such as in a Table.
  • The rhythm can also help organize elements that may have different levels of importance, such as in a Dashboard.

Example of elements with the same level of importance.
Example of elements with different levels of importance.

Consistent density within the Admin​

Blank spaces are used up to the point that makes it easier to consume information, since the Admin is a tool for work. The density adopted in an interface needs to follow the Admin pattern.

  • Tighter spacing – more dense – increases the level of scannability for large sets of data, such as in a Table.
  • Looser spacing – less dense – increases the level of hierarchy or helps define groups within an interface, such as Form sections.


Example of tighter spacing.
Example of looser spacing.

Visual weight​

The spacing scale can be applied horizontally or vertically. Depending on the visual weight of the element, sometimes using the same value on both axes doesn't result in a balanced composition. In these scenarios, it's necessary to optically adjust the spacing.

Observe if the components have a well-defined background (filled or with stroke) or not. For example, the spacing value between primary and secondary Buttons should be larger than the spacing value between two tertiary Buttons.



Example of different spacing between components with filled background and without background.
Example of optical adjustment with the horizontal padding larger than the vertical padding.