Skip to main contentCarbon Design System

Spacing

The Carbon layout package helps teams build consistent experiences through spacing and alignment.

If you’re using

@carbon/react
, you probably don’t need need to install the layout package separately. See our Carbon React guide to start building.

Usage

The

@carbon/layout
package provides spacing tokens and conversion utilities for the Carbon Design System. You can access these tokens and helpers by writing the following:

@use '@carbon/layout';
.selector {
margin-bottom: layout.$spacing-05;
width: layout.rem(24px);
height: layout.rem(24px);
}

API


ExportDescription!default
$spacing-01
âś…
$spacing-02
âś…
$spacing-03
âś…
$spacing-04
âś…
$spacing-05
âś…
$spacing-06
âś…
$spacing-07
âś…
$spacing-08
âś…
$spacing-09
âś…
$spacing-10
âś…
$spacing-11
âś…
$spacing-12
âś…
$spacing-13
âś…
$spacing
$fluid-spacing-01
âś…
$fluid-spacing-02
âś…
$fluid-spacing-03
âś…
$fluid-spacing-04
âś…
$fluid-spacing
@function em
@function rem
$base-font-size
âś…

Configuration

You can configure parts of the

@carbon/layout
package that are
!default
with Sass Modules. For example, you can change the
$base-font-size
by writing the following:

@use '@carbon/layout' with (
$base-font-size: 18px
);

Resources