Space
This guide will help you make decisions when spacing elements in your designs using our space Tokens. Use this for onboarding or as a refresher.
yarn add @workday/canvas-kit-react
yarn add @workday/canvas-kit-react
Usage Guidance
Spacing is defined by “T-shirt sizes” varying from XXXS to XXXL with numbers divisible by four.
Our spacing guidelines are based on the principles of visual design. We recommend using these guidelines to provide a consistent visual experience across your product.
Before making decisions on how to use our space tokens in your product it is good to know the rationale behind our spacing system. The following section outlines this.
8pt grid system
At Workday we use a systematic approach to how we decide what spacing to use in order to achieve a consistent visual experience across our products. We achieve this by using a spacing system. At Workday we follow the 8pt Grid System.
The main benefits of using an 8pt grid system are:
- Flexible and consistent to work with while offering enough visual distinction between steps.
- Scales well, avoiding blurred images caused by half pixel rendering on some screen densities.
Canvas Space Tokens
This section outlines the current space tokens that we support. Our space tokens include the current spacing values in Pixels. Use these space tokens when positioning Canvas components in your product.
We have aligned our base space size to our base font size (16px) to help you to space elements in your product relative to our type scale. This will help your overall layout to scale proportionality.
Recommended Usage
Choose from the space tokens below to see their recommended usage.
Space.zero
0 px
Use sparingly
When elements are stacked and require no space between them
Rows of data e.g. tables

Space.xxxs
4 px
Use sparingly
Accommodate a large amount of data on your page
Compact spacing between text or icons

Space.xxs
8 px
Commonly used to group compact elements like icon buttons
Accommodate a large amount of data on your page
Compact spacing between text or icons

Space.xs
12 px
Use sparingly
Use when compact padding is required
Accommodate a large amount of data on your page

Space.s
16 px
Use this as your base to help you decide on relevant larger or smaller spacing sizes
Grouping Inputs with related data
Group related input fields

Space.m
24 px
Padding around card content
Related elements where more space between them can be afforded
Separate section headings or titles from body text or inputs

Space.l
32 px
Standard spacing between cards
Used to separate groups of content
Separate section headings or titles from body text or inputs

Space.xl
40 px
Used for outer margins on the overall page content
Used for inner margins on large items such as page sections

Space.xxl
64 px
Use to de-clutter your UI when alot of space is available
Separate banner sections from page content
Use to differentiate page content like page sections

Space.xxxl
80 px
Use sparingly
Helps to put focus on the primary element within your page
Use to de-clutter your UI when a lot of space is available

The table below displays all the current space token names for your reference, along with their
equivalent pixel values. Space variables are in a "t-shirt size" format. Space values are in px
format (space
object) or number format (spaceNumbers
object).
Token Name | Size (px) | Size (number) | Space |
---|---|---|---|
zero | 0px | 0 | |
xxxs | '4px' | 4 | |
xxs | '8px' | 8 | |
xs | '12px' | 12 | |
s Base Value | '16px' | 16 | |
m | '24px' | 24 | |
l | '32px' | 32 | |
xl | '40px' | 40 | |
xxl | '64px' | 64 | |
xxxl | '80px' | 80 |
The following space types are also provided: CanvasSpace
, CanvasSpaceValues
,
CanvasSpaceNumbers
, and CanvasSpaceNumberValues
.
Below are descriptions of these types:
Name | Description |
---|---|
CanvasSpace | space object with string px values |
CanvasSpaceValues | string px values for CanvasSpace |
CanvasSpaceNumbers | spaceNumbers object with numeric px values |
CanvasSpaceNumberValues | numeric px values for CanvasSpaceNumbers |
Web Examples
import {space, spaceNumbers} from '@workday/canvas-kit-react/tokens';const iconSize = 20;const buttonSyles = {paddingTop: space.xs,paddingRight: space.s,paddingBottom: space.xs,paddingLeft: spaceNumbers.s + iconSize,};
Can't Find What You Need?
Check out our FAQ section which may help you find the information you're looking for.
FAQ Section