Skip to content
WunderUI

Dashboard Grid

Pro

A grid of dashboard cards on 12 columns that people rearrange: drag a card or its corner in whole cells, or use the keyboard, and the cards it lands on make room. On tablets and phones the cards stack.

Playground

Revenue

$184,920

+8.2% vs last month

Open deals

26

$412,300 in the pipeline

Overdue invoices

7

$18,460 outstanding

Tasks due today

12

4 assigned to Nora Lindgren

Press Enter to grab the card. Arrow keys move it, Shift and arrow keys resize it, Enter drops it, Escape cancels.

Drag the handle or the corner, or focus a handle: Enter grabs, arrow keys move, Shift and arrow keys resize, Enter drops, Escape cancels.

Installation

Dashboard Grid comes with WunderUI Core and Pro, in the package from your plan. See the plans.

Then import what you need:

tsx
import {
  DashboardGrid,
  DashboardGridBreakpoint,
  DashboardGridItem,
  DashboardGridProps,
  DashboardGridSize,
} from "@wunderui/react"

Width

The grid measures its own width, not the window. Below 1024 px it has 6 columns and below 640 px one; the cards scale their width and stack in reading order. Editing works at full width only, so a layout is always arranged on 12 columns. Pass breakpoints for other steps.

Revenue

$184,920

+8.2% vs last month

Open deals

26

$412,300 in the pipeline

Overdue invoices

7

$18,460 outstanding

Tasks due today

12

4 assigned to Nora Lindgren

Anatomy

The parts the component is made of. Each one renders a you can target from CSS.

Revenue

$184,920

+8.2% vs last month

Open deals

26

$412,300 in the pipeline

Overdue invoices

7

$18,460 outstanding

Tasks due today

12

4 assigned to Nora Lindgren

Press Enter to grab the card. Arrow keys move it, Shift and arrow keys resize it, Enter drops it, Escape cancels.
  • data-slot="dashboard-grid"

    A CSS grid of 12 columns with 80 px rows and 16 px gaps that hugs its content. It measures its own width: 6 columns below 1024 px, 1 below 640 px.

  • data-slot="dashboard-grid-item"

    Wraps what renderItem returns. In editing mode a dashed border-control outline marks the card; a grabbed or dragged card gets the primary outline and the lg shadow.

  • data-slot="dashboard-grid-handle"

    A square 24 px icon button in the top-start corner of the card in editing mode. It sits over the card's top-start corner, so keep the top 32 px of a card free while editing: the grid is a , so on the card makes the room. Drag it, or press Enter to grab, the arrow keys to move, Shift and the arrow keys to resize, Enter to drop and Escape to cancel; an assertive live region says where the card is.

  • data-slot="dashboard-grid-resize"

    A 24 px corner at the bottom right for the pointer; the keyboard resizes from the handle.

  • data-slot="dashboard-grid-placeholder"Optional

    While a card is dragged, a grey dashed cell on bg-page shows where it will land.

  • data-slot="dashboard-grid-actions"Optional

Best practices

  • When to use

    Use a Dashboard Grid when people arrange their own board of cards. For a fixed layout use a plain CSS grid.

  • Do

    Give every item a label; announcements use it ("Revenue moved to column 3, row 1").

  • Do

    Edit on a draft: Edit layout copies the items, Save keeps them, Cancel throws them away.

  • Do

    Set minW and minH so a card never gets too small for its chart.

  • Don’t

    Don't make the cards themselves draggable; the handle is the one place to grab, so clicks inside a card still work.

  • Do

    Give ChartCard and MetricCard fill inside a cell so the chart takes the cell height, set columnGap and rowGap apart (cards side by side 24, stacked 16), sizes per breakpoint with layouts, and card buttons with renderActions instead of a header inside the card.

API reference

One table per part, in the order of the anatomy. Every part also takes the props of the Base UI part it wraps (such as , and ) and the native attributes of its element.

A CSS grid of 12 columns with 80 px rows and 16 px gaps that hugs its content. It measures its own width: 6 columns below 1024 px, 1 below 640 px.

PropTypeDefaultDescription
items requiredDashboardGridItem[]—
renderItem required(id) => ReactNode—
breakpointsDashboardGridBreakpoint[]DEFAULT_BREAKPOINTSDefault: tablet below 1024 px → 6 columns, phone below 640 px → 1 column. Editing works at full width only.
columnGapnumber—Space between cards side by side in px; defaults to .
columnsnumber12Columns at full width.
editingbooleanfalseShows the frame, the move handle and the resize corner on every card.
gapnumber16Space between cards in px (both directions; and override it).
layoutsRecord<number, DashboardGridSize[]>—Sizes per breakpoint, keyed by its column count: . A card listed there takes that width and height when the grid has that many columns; the others scale their width and keep th…
onLayoutChange(items) => void—Called with all items after a drop or a resize (pointer or keyboard).
renderActions(id) => ReactNode—Extra controls of a card in editing mode (duplicate, remove …), top end, beside the move handle.
rowGapnumber—Space between stacked cards in px; defaults to . Dragging snaps by .
rowHeightnumber80Height of one row in px.

Notes for AI

Give your coding assistant the Markdown reference instead of screenshots.

MCPget_component("dashboard-grid")
InstallIncluded in Core and Pro

The full library index for assistants is at /llms.txt.