Skip to content
Alea0.1

Layout

Stack, Inline, Grid

Space things out with the space scale: columns, rows that wrap, responsive grids, the page container and dividers.

Ant Design: Space, Flex, Grid, Layout, Divider

import { Stack, Inline, Grid, Container, Divider } from '@alea/ui';

Examples

Stack and Inline

Stack puts children in a column, Inline in a row that wraps. Gap comes from the space scale.

Stack with gap 4 (16 px)

TokensAccessibleReact Aria

Grid

columns="auto" fits as many columns as minItemWidth allows: responsive with no breakpoints.

Palette

Figma plugin

Contrast

Figma plugin

Type scale

Figma plugin

Color vision

Figma plugin

Tokens

Figma plugin

A11y

Figma plugin

Divider

A separator between groups, horizontal or vertical.

Above

Left

Right

Props

Stack props

Children in a column with even space between them.

PropTypeDefaultDescription
align"center" | "start" | "end" | "stretch" | "baseline"-Cross-axis alignment: start, center, end, stretch or baseline.
asElementType'div'The element to render. Default div.
gapResponsive<Space>4Space between children, from the space scale. Default 4 (16 px). Can change per breakpoint.
justify"center" | "start" | "end" | "between"-Main-axis distribution: start, center, end or between.

Inline props

Children in a row, wrapping by default.

PropTypeDefaultDescription
align"center" | "start" | "end" | "stretch" | "baseline"'center'Cross-axis alignment: start, center, end, stretch or baseline.
asElementType'div'The element to render. Default div.
gapResponsive<Space>2Space between children, from the space scale. Default 4 (16 px). Can change per breakpoint.
justify"center" | "start" | "end" | "between"-Main-axis distribution: start, center, end or between.
wrapbooleantrueWrap onto new lines when there is no room. Default true.

Grid props

A responsive grid: fixed columns, as many as fit, or a different count per breakpoint.

PropTypeDefaultDescription
asElementType'div'The element to render. Default div.
columnsResponsive<number | "auto">'auto'Columns: a number, 'auto' to fit as many as minItemWidth allows, or one per breakpoint: { base: 1, md: 2, lg: 4 }. Use 12 with GridItem spans for page layouts.
gapResponsive<Space>4Space between cells, from the space scale. Default 4 (16 px). Can change per breakpoint.
minItemWidthnumber240Smallest column width for columns='auto'. Default 240 px.

Container props

Centers content at a max width with the page gutters.

PropTypeDefaultDescription
asElementType'div'The element to render. Default div.
size"sm" | "md" | "lg" | "xl" | "full"'xl'Max width: sm 640, md 768, lg 1024, xl 1280 (the default page width), full.

Divider props

A thin rule between groups.

PropTypeDefaultDescription
spacing0 | 2 | 3 | 4 | 5 | 6 | 1 | 12 | 24 | 0.5 | 7 | 8 | 10 | 16 | 200Spacing around the line, from the space scale.

Accessibility

  • Layout components add no roles, except Divider, which is a separator.
  • Pick the element with as (section, ul, nav) so the structure means something.

Do and don't

Do

  • Use gap from the scale instead of margins on children.

Don't

  • Don't use Grid for tables of data: use a table.
Tested with axe, keyboard and screen reader roles