Skip to main content

Sizing and Spacing

Spacing and sizing tokens are used to provide consistent spacing and sizing in your app. All sizing and spacing properties are defined in rem.

REM Unit

rem is a relative length unit. it's relative to the font size of the root element.

Sizing

Use these properties to adjust the sizing of the component (width, height). m is the standard size for almost all components.

Choosing a size

When choosing a size, always make sure to keep it large enough for tap targets.

Example

.element {
width: var(--dwc-size-m);
height: var(--dwc-size-m);
}

Variables

VariableDefault ValueExample
--dwc-size-3xs1.125rem
--dwc-size-2xs1.375rem
--dwc-size-xs1.625rem
--dwc-size-s1.875rem
--dwc-size-m2.25rem
--dwc-size-l2.75rem
--dwc-size-xl3.5rem
--dwc-size-2xl4rem
--dwc-size-3xl4.25rem
--dwc-sizevar(--dwc-size-m)

Spacing

Use these properties to adjust the inter-component spacing (margin, padding).

Example

.element {
padding: var(--dwc-space-m);
}

Variables

VariableDefault ValueExample
--dwc-space-3xs0.075rem
--dwc-space-2xs0.15rem
--dwc-space-xs0.25rem
--dwc-space-s0.5rem
--dwc-space-m1rem
--dwc-space-l1.25rem
--dwc-space-xl1.5rem
--dwc-space-2xl1.75rem
--dwc-space-3xl2rem
--dwc-spacevar(--dwc-space-s)