Introduction
Spacing Values
Spacing values range from 1 to 6, with 1 being the smallest and 6 the largest. These values follow the eight-point grid system for consistent spacing.
Local Variable | Value | Visual Size |
---|---|---|
spacer-1 | 8 | |
spacer-2 | 16 | |
spacer-3 | 24 | |
spacer-4 | 40 | |
spacer-5 | 64 | |
spacer-6 | 104 |
Understanding the Scale
The spacing values in Natura11y are based on a base unit of 1rem
(typically 16px). Each subsequent value is a multiple of this base unit, but the increase is not linear. Instead, the values grow more significantly as they get larger. Specifically, each value is the sum of the previous two values. For example, 8 + 8 = 16, 16 + 8 = 24, and so on.
This scaling system allows you to apply spacing that increases more quickly with larger values, providing flexibility in how much space you can create between elements.
Padding and Margin Utilities
You can apply padding or margin to all sides of an element using the .padding-{x}
or .margin-{x}
classes, where x equals the spacer amount (from 1 to 6). Figure 1 demonstrates different padding utilities applied to boxes.
Figure 2 shows different margin utilities applied to boxes.
Direction-Specific Utilities
You can apply padding or margin to a specific side, top and bottom, or left and right of an element. Figure 3 provides examples of these directional utilities with a spacer value of 2.
Breakpoint Modifiers
Natura11y's padding and margin utilities also support breakpoint modifiers for responsive designs.