Dashboard Grid
ProA 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
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:
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
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
- 1data-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.
- 2data-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.
- 3data-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.
- 4data-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.
| Prop | Type | Default | Description |
|---|---|---|---|
| items required | DashboardGridItem[] | — | |
| renderItem required | (id) => ReactNode | — | |
| breakpoints | DashboardGridBreakpoint[] | DEFAULT_BREAKPOINTS | Default: tablet below 1024 px → 6 columns, phone below 640 px → 1 column. Editing works at full width only. |
| columnGap | number | — | Space between cards side by side in px; defaults to . |
| columns | number | 12 | Columns at full width. |
| editing | boolean | false | Shows the frame, the move handle and the resize corner on every card. |
| gap | number | 16 | Space between cards in px (both directions; and override it). |
| layouts | Record<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. |
| rowGap | number | — | Space between stacked cards in px; defaults to . Dragging snaps by . |
| rowHeight | number | 80 | Height of one row in px. |
Notes for AI
Give your coding assistant the Markdown reference instead of screenshots.
get_component("dashboard-grid")The full library index for assistants is at /llms.txt.
Related components
- To do2FeatureDesign
Address autocomplete for the shipping form
Nov 1832/3MKDO
DesignRedesign the product grid
Nov 215PRIn progress2 / 3FeatureApple Pay and Google Pay buttons
x40%Nov 144/10TFPRBugFix the double submit on slow networks
Nov 1210/2DOIn review1ContentCopy review for the error messages
Nov 152MKPress Space or Enter to pick up the card. Then use the arrow keys to move it within its column or to the next column, Space or Enter to drop it, and Escape to cancel.
Core Elements5 stylesProKanbanA drag-and-drop board of columns and cards.