Mushilu-San UI

Search components

PlaygroundStorybookGitHub
Layout

Grid

Lays out children in a fixed number of equal columns, with gaps between them.

Selector: mui-grid

Import
import { Grid } from '@mushilu-san/ui/layout';
PreviewCode

Loading example…

Overview

Grid places its children in columns equal tracks. gap sets both gaps in spacing steps, and columnGap or rowGap override one axis. align and justify set how items sit inside their cells.

Use a grid for cards and tiles of the same size. Use a Stack when items flow in one direction.

When to use

  • A set of cards or tiles that should line up in columns.
  • A dashboard with equal-width panels.

When not to use

  • A single row or column of items. Use a Stack. Use Stack instead.

Guidelines

Do

  • Use fewer columns on narrow screens, such as 1 or 2, so each item keeps a readable width.

Don't

  • Do not use a grid to fake a table. Use a Table.

Accessibility

Roles and attributes

ElementRoleNotes
host—A layout wrapper. Visual order should match reading order.
  • Keep the DOM order the same as the reading order. Do not rely on CSS to reorder items for screen readers.

API

Grid

Selector: mui-grid

NameTypeDefaultDescription
columnsnumber1 Number of equal-width columns (uses `repeat(n, minmax(0, 1fr))`).
gapnumber4 Gap applied to both axes — a step on the spacing scale (--mui-space-{n}). Overridden by columnGap/rowGap.
columnGapnumber | undefinedundefined Column gap override — a step on the spacing scale (--mui-space-{n}).
rowGapnumber | undefinedundefined Row gap override — a step on the spacing scale (--mui-space-{n}).
align'start' | 'center' | 'end' | 'stretch''stretch' Block-axis alignment of grid items (align-items).
justify'start' | 'center' | 'end' | 'stretch''stretch' Inline-axis alignment of grid items (justify-items).

CSS parts

  • ::part(root)

Tokens

  • --mui-space-4