Column LayoutPro

A switcher between two 3D views, a tilted stack and a sideways row, with cards easing smoothly to their place and an optional blur while they move.

Preview

Open the component on its own page in a new tab ↗

Usage

Wrap a switcher and a grid in ColumnLayout. They can sit anywhere inside it, so the switcher can live in a header while the grid is further down.

Example
<ColumnLayout defaultValue="2">
  <ColumnLayoutSwitcher />
  <ColumnLayoutGrid>
    {projects.map((p) => <Card key={p.id} {...p} />)}
  </ColumnLayoutGrid>
</ColumnLayout>

Pass your own layouts to change the options.

Example
const layouts = [
  { id: "list", label: "List", columns: 1 },
  { id: "grid", label: "Grid", columns: 4 },
  { id: "3d-1", label: "3D - 1", columns: 1, variant: "stack" },
  { id: "3d-2", label: "3D - 2", columns: 1, variant: "row" },
]

variant: "stack" tilts a single column back in perspective; "row" turns the items into a sideways-scrolling 3D row. Add <ColumnLayoutBlurToggle /> to let people switch the blur (shown while items move between layouts) on or off.

Below the sm breakpoint the grid is always a single column.

Props

PropTypeDefaultNotes
layouts{ id; label; columns; variant? }[]3D - 1, 3D - 2On ColumnLayout. The available options.
value / defaultValuestringfirst layoutOn ColumnLayout. Selected layout id.
onValueChange(id: string) => void—On ColumnLayout. Called on selection.
blur / defaultBlurbooleantrueOn ColumnLayout. Blur items while they move.
gapstring"gap-4"On ColumnLayoutGrid. Tailwind gap class.
labelstring"Layout"On ColumnLayoutSwitcher. Accessible name.

Accessibility

  • The switcher is a radiogroup; arrow keys move and select, with one tab stop
  • Respects reduced motion by snapping and skipping the 3D tilt and the blur; the blur toggle is a switch