Grid

Small CSS grid helpers — container widths, 2–4 columns (responsive), and auto-fit tracks. Pair with Card and Spacing.

Preview

Live

1
2
3
span 2
6
<div class="ui-container">
  <div class="ui-grid ui-grid--3 gap-3">
    <div>1</div>
    <div>2</div>
    <div>3</div>
    <div class="ui-grid__span-2">span 2</div>
    <div>6</div>
  </div>
</div>

Variants

Fixed columns

.ui-grid--2--4. Collapses to 1 col under 768px; 3–4 become 2 cols mid-width.

A
B
C
D

Auto-fit

.ui-grid--auto — tracks grow from ~14rem.

Auto
Fit
Tracks

Container

.ui-container (72rem), --narrow (40rem), --wide (90rem).

Narrow container

Accessibility

  • Grid is presentational — keep a sensible source order for keyboard and AT.
  • Do not use CSS grid for tabular data; use Table.
  • Spans reset on small screens so content stays a single column — verify focus order still matches reading order.

API

HTML classes

Class Description
.ui-container (+ --narrow / --wide) Centered max-width wrapper.
.ui-grid Base CSS grid (1 column + gap).
.ui-grid--2 / --3 / --4 / --auto Column templates.
.ui-grid__span-2 / .ui-grid__span-full Column spans (span-2 resets under 768px).
.gap-{n} Override gap from the space scale.

React

Container and Grid from src/core/Layout.tsxcolumns / size / gap props.