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
penumNo default value
pxenumNo default value
pyenumNo default value
ptenumNo default value
prenumNo default value
pbenumNo default value
plenumNo default value
positionResponsive<"static" | "relative" | "absolute" | "fixed" | "sticky">No default value
insetResponsive<"auto" | "0" | "50%" | "100%">No default value
topResponsive<"auto" | "0" | "50%" | "100%">No default value
rightResponsive<"auto" | "0" | "50%" | "100%">No default value
bottomResponsive<"auto" | "0" | "50%" | "100%">No default value
leftResponsive<"auto" | "0" | "50%" | "100%">No default value
widthenumNo default value
heightenumNo default value
shrinkResponsive<"0" | "1">No default value
growResponsive<"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
menumNo default value
mxenumNo default value
myenumNo default value
mtenumNo default value
mrenumNo default value
mbenumNo default value
mlenumNo 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%