Skip to content
Browse documentation
whisk/ui

Spacing

Build a consistent layout rhythm with the shared spacing scale.

Spacing scale

Spacing tokens create a predictable rhythm for padding, margin, gap, and inset. Each numeric step is multiplied by 0.25rem (4px at the default root font size), so 0.5 resolves to 0.125rem (2px). The documented values are common landmarks, not an authoring limit.

0

0rem

(0px)

0.5

0.125rem

(2px)

1

0.25rem

(4px)

1.5

0.375rem

(6px)

2

0.5rem

(8px)

2.5

0.625rem

(10px)

3

0.75rem

(12px)

3.5

0.875rem

(14px)

4

1rem

(16px)

4.5

1.125rem

(18px)

5

1.25rem

(20px)

5.5

1.375rem

(22px)

6

1.5rem

(24px)

6.5

1.625rem

(26px)

7

1.75rem

(28px)

7.5

1.875rem

(30px)

8

2rem

(32px)

8.5

2.125rem

(34px)

9

2.25rem

(36px)

10

2.5rem

(40px)

11

2.75rem

(44px)

12

3rem

(48px)

13

3.25rem

(52px)

14

3.5rem

(56px)

15

3.75rem

(60px)

16

4rem

(64px)

20

5rem

(80px)

24

6rem

(96px)

25

6.25rem

(100px)

28

7rem

(112px)

32

8rem

(128px)

36

9rem

(144px)

37.5

9.375rem

(150px)

40

10rem

(160px)

44

11rem

(176px)

48

12rem

(192px)

50

12.5rem

(200px)

52

13rem

(208px)

56

14rem

(224px)

60

15rem

(240px)

64

16rem

(256px)

72

18rem

(288px)

80

20rem

(320px)

96

24rem

(384px)

Apply spacing

Use gap for the relationship between siblings, padding for space inside a surface, and margin only when the space belongs to the component’s external boundary.

Deployment ready

The production checklist has no remaining blockers.

import { Box, Stack, Text } from "@smoothie-framework/whisk-react";

<Stack gap={{ base: 3, md: 5 }}>
  <Box background="surface2" rounded="lg" padding={{ base: 3, md: 5 }}>
    <Stack gap={2}>
      <Text textStyle="caption">Deployment ready</Text>
      <Text textStyle="body" color="subtle">The production checklist has no remaining blockers.</Text>
    </Stack>
  </Box>
</Stack>

Spacing props

Use spacing values through component props so the layout remains responsive and theme-aligned.

PropTypeDefaultDescription
padding / paddingX / paddingY (p / px / py aliases)Responsive<SpacingStep>noneAdd numeric spacing steps around a component or along one axis.
margin (m alias)Responsive<SpacingStep | string | { x?: UtilityValue; y?: UtilityValue }>noneNumeric values use spacing steps; margin also accepts CSS values such as auto or one x/y object.
marginX / marginY (mx / my aliases)Responsive<SpacingStep | string>noneAdd numeric spacing steps or a CSS value such as auto along one axis.
gapResponsive<SpacingStep>noneSet consistent space between children in Stack, Grid, and related layouts.
insetSpacingValuenonePosition an element from its containing edges when the component exposes inset.