Spacings

Discover how to utilize and customize spacings in Design Blocks to enhance the layout and visual rhythm of your project.


Use the spacings key in the extendTokens section of your blocks.config.ts file to extend the default spacing values.

ts
const [lightThemeTokens] = createTokens({
  theme: {
    extendTokens: {
      spacings: {
        // Configure your spacing here
      },
    },
  },
});

Overriding the default spacing

if you’d like to override the default spacings, you can do so using the theme.tokens.spacings section of your blocks.config.ts file:

ts
const [lightThemeTokens] = createTokens({
  theme: {
    tokens: {
      spacings: {
        none: 0,
        xxs: 8,
        xs: 12,
        baseSpacing: 4,
      },
    },
  },
});

Spacing tokens

Design Blocks ships with the following spacing tokens by default:

NameValue
none0
xxs4
xs8
sm12
md16
lg24
xl32
2xl40
3xl48
4xl56
5xl64
6xl72
full'100%'
baseSpacing8