Skip to content

Padding

Padding and radius are defined together — each semantic element type has considered defaults that match its personality.

Base mixin — padding at a named size with optional radius:

@include padding-box; // md size, no radius
@include padding-box("sm"); // sm size, no radius
@include padding-box("md", "md"); // md size, md radius
ParameterDefaultDescription
$size"md"Padding size — xs, sm, md, lg, xl, 2xl
$radiusnullRadius size — none, sm, md, lg, xl, 2xl

Default padding values — handcrafted ratios landing on clean space tokens:

SizeBlockInline
xs--space-1--space-2
sm--space-2--space-3
md--space-3--space-5
lg--space-4--space-6
xl--space-5--space-7
2xl--space-6--space-8

If $box-ratio is set in config to a value other than 2, inline padding is calculated as block × ratio instead of using the handcrafted values.


Each element type has a mixin with considered defaults. Size is overridable:

@include box-input; // md padding, md radius
@include box-input("sm"); // sm padding, md radius
@include box-button; // md padding, md radius
@include box-button("sm"); // sm padding, md radius
@include box-button("lg"); // lg padding, md radius
@include box-card; // md padding, lg radius
@include box-card("lg"); // lg padding, lg radius
@include box-badge; // sm padding, sm radius
@include box-tooltip; // xs padding, sm radius
@include box-modal; // lg padding, xl radius