Guides

Layout

Declarative layout and common spacing props.

Layout components

Box, Flex and Grid are foundational elements you'll use to construct layouts. Box provides block-level spacing and sizing, while Flex and Grid let you create flexible columns, rows and grids.

<Grid columns="3" gap="3">
<Flex direction="column" gap="3">
<Box height="5">
<DecorativeBox />
</Box>
<Box height="7">
<DecorativeBox />
</Box>
<Box height="9">
<DecorativeBox />
</Box>
</Flex>
<Flex direction="column" gap="3">
<Box grow="1">
<DecorativeBox />
</Box>
<Box height="6">
<DecorativeBox />
</Box>
</Flex>
</Grid>

Container and Section are used for page level layout and allow you to contain the max width of content or apply consistent vertical spacing between sections.

All layout components share a common set of props:

PropTypeDefault
p
enum
No default value
px
enum
No default value
py
enum
No default value
pt
enum
No default value
pr
enum
No default value
pb
enum
No default value
pl
enum
No default value
position
Responsive<"static" | "relative" | "absolute" | "fixed" | "sticky">
No default value
inset
Responsive<"auto" | "0" | "50%" | "100%">
No default value
top
Responsive<"auto" | "0" | "50%" | "100%">
No default value
right
Responsive<"auto" | "0" | "50%" | "100%">
No default value
bottom
Responsive<"auto" | "0" | "50%" | "100%">
No default value
left
Responsive<"auto" | "0" | "50%" | "100%">
No default value
width
enum
No default value
height
enum
No default value
shrink
Responsive<"0" | "1">
No default value
grow
Responsive<"0" | "1">
No default value

Margin props

Shorthand utilities for applying margin to any side of an element, useful when you need to apply space between elements. Margin props are available on components that render a node.

<Button mr="3" variant="soft">Cancel</Button>
<Button>Save changes</Button>
PropTypeDefault
m
enum
No default value
mx
enum
No default value
my
enum
No default value
mt
enum
No default value
mr
enum
No default value
mb
enum
No default value
ml
enum
No default value

Spacing scale

Spacing values are derived from a 9 step scale.

1
2
3
4
5
6
7
8
9
StepBase value
14px
28px
312px
416px
524px
632px
740px
848px
964px

Scaling

Values which affect layout (spacing, typographic sizing, line heights) scale relatively based on the scaling value defined in your Theme. This setting allows you to scale the UI density uniformly across your entire application.

90%
95%
100%
105%
110%