Spacing are used to consistently apply margin and padding across elements, components and layouts. With a set scale for spacing, information can be structured to have a consistent and intuitive user interface across the website.
Use of space
A vertical rhythm starts from a baseline and it's the basis for everything from the font sizes, line height and image sizes. The spacing are always referring to fixed values and thus they are not responsive. All spacing can be used as values for both margins and paddings.
Space is used to create hierarchy and visual relationships. By using the spacing, you can achieve visual grouping and other associations both between and within the components. Along with the typography system, they contribute to an overall visual hierarchy, providing users with a structured way of organising information.
Spacing values
| Name | Size |
|---|---|
| 13xl | 0px - 4.5rem |
| 12xl | 0px - 4.25rem |
| 11xl | 0px - 4rem |
| 10xl | 0px - 3.75rem |
| 9xl | 0px - 3.5rem |
| 8xl | 0px - 3.25rem |
| 7xl | 0px - 3rem |
| 6xl | 0px - 2.75rem |
| 5xl | 0px - 2.5rem |
| 4xl | 0px - 2.25rem |
| 3xl | 0px - 2rem |
| 2xl | 0px - 1.75rem |
| xl | 0px - 1.5rem |
| l | 0px - 1.25rem |
| m | 0px - 1rem |
| s | 0px - 0.75rem |
| xs | 0px - 0.5rem |
| 2xs | 0px - 0.375rem |
| 3xs | 0px - 0.25rem |
| 4xs | 0px - 0.125rem |
| 5xs | 0px - 0.0625rem |
Do's
- always use the spacing values when spacing out element (either margin or padding)
Don'ts
- don't go outside the provided spacing values
- don't stack the spacing (such as 0px + 0px)
When to use
- whenever you need to space out the inner parts within a component (when creating a new component that is outside what ECL provided)
- whenever you need to space out one component from another or other elements outside of a component
When not to use
- do not use when you want to have responsive spacing since the values are fixed