Layout grid
Contained and fluid page layouts
A page uses one of two layouts: contained, for pages people read, or fluid, for dashboards and application shells.
The layout's container sets the width of the page and the padding at its edge. The space between tiled blocks, such as cards, is the default flow step of the context.
Use
Put a layout class on the element that holds the page content. Use .container for an article, documentation or a form, and .container-fluid for a dashboard or an application shell:
<main class="container-fluid">…</main>To tile cards or panels, put gap-flow on the grid or flex container. The gap is the default flow step of the context, so it changes when the grid moves into a different context:
<section class="flow-standard">
<div class="gap-flow grid grid-cols-1 md:grid-cols-3">
<Card title="Population">…</Card>
<Card title="Housing">…</Card>
<Card title="Transport">…</Card>
</div>
</section>The layout classes and gap-flow are in the theme package's CSS, so they work without Tailwind. The example sets columns with Tailwind's grid utilities, which the component library uses. CSS grid works as well.
How it works
Contained and fluid
The contained layout is for document-like pages, such as articles, documentation and forms. Its width steps up at each breakpoint, it is centred, and its padding grows with the viewport.
The fluid layout is for dashboards and application shells. It fills the width of the viewport, and its padding stays between 16px and 24px.
| Breakpoint | Minimum width | Contained width | Contained padding | Fluid padding |
|---|---|---|---|---|
base | None | 100% | 16px | 16px |
sm | 640px | 640px | 32px | 16px |
md | 768px | 768px | 32px | 24px |
lg | 1024px | 1024px | 64px | 24px |
xl | 1280px | 1280px | 80px | 24px |
2xl | 1536px | 1536px | 96px | 24px |
The page edge
The container's padding sets the page edge. Components don't add padding at the page edge. A component's own padding comes from the spacing scale, whatever layout it sits in.
Space between tiled blocks
The space between tiled blocks is the default flow step of the context, set with gap-flow. A row of cards and a stack of cards then have the same space between them.
Here the same three panels are tiled in a standard context and then in a spacious one:
<div class="flow-standard">
<div class="gap-flow grid grid-cols-3">…</div>
</div>
<div class="flow-spacious">
<div class="gap-flow grid grid-cols-3">…</div>
</div>Standard: 8px between panels
Spacious: 16px between panels
A fixed gap, such as gap-4, doesn't follow the context. Use gap-flow.
Columns
There are no column tokens. The number of columns depends on the content of each page, so each page sets its own with CSS grid or Tailwind's grid utilities.
Reference
Container padding
| Token | Value | Pixels |
|---|---|---|
--grid-base-contained-container-padding | 1rem | 16px |
--grid-base-fluid-container-padding | 1rem | 16px |
--grid-sm-contained-container-padding | 2rem | 32px |
--grid-sm-fluid-container-padding | 1rem | 16px |
--grid-md-contained-container-padding | 2rem | 32px |
--grid-md-fluid-container-padding | 1.5rem | 24px |
--grid-lg-contained-container-padding | 4rem | 64px |
--grid-lg-fluid-container-padding | 1.5rem | 24px |
--grid-xl-contained-container-padding | 5rem | 80px |
--grid-xl-fluid-container-padding | 1.5rem | 24px |
--grid-2xl-contained-container-padding | 6rem | 96px |
--grid-2xl-fluid-container-padding | 1.5rem | 24px |
Breakpoints
| Breakpoint | Minimum width |
|---|---|
base | None |
sm | 640px |
md | 768px |
lg | 1024px |
xl | 1280px |
2xl | 1536px |
The full rules for the layout grid are in the specification.