Construct a grid, onboard columns through grid.columns with size percentages, then register rows to get column layout, search, sort, and pagination. Columns are onboarded — not passed as a factory option — so the surface matches createDataTable and columns can be added or removed at any time.
ts
Open in Vuetify Bin
Code size: medium
Enable line wrap
Copy code
import { createDataGrid } from '@vuetify/v0'const grid =createDataGrid()// Onboard columns through the inherited column registrygrid.columns.onboard([ { id: 'name', title: 'Project', sortable: true, filterable: true, size: 22 }, { id: 'status', title: 'Status', sortable: true, size: 12 }, { id: 'assignee', title: 'Assignee', sortable: true, size: 16 }, { id: 'progress', title: 'Progress', sortable: true, size: 14 }, { id: 'budget', title: 'Budget', sortable: true, size: 10 },])// Register rows through the inherited registry surfacegrid.onboard(projects.map(value => ({ id: value.id, value })))// Inherited from createDataTablegrid.search('alice')grid.sort.toggle('name')grid.pagination.next()// Grid-specific: column layoutgrid.layout.columns.value // ResolvedColumn[] with size, offset, pinnedgrid.layout.pin('name', 'left')grid.layout.resize('name', 5) // grow by 5%, neighbor shrinksgrid.layout.reorder(0, 2) // move column 0 to position 2grid.layout.hide('budget') // exclude from the render setgrid.layout.reset() // restore initial layout
The grid uses the standard data table adapters — row ordering is layered above the pipeline, not inside it, so any DataTableAdapter works without modification.
import { createDataGrid } from '@vuetify/v0'const grid =createDataGrid()// ClientDataTableAdapter is the default — no adapter option requiredgrid.columns.onboard(columns)grid.onboard(employees.map(value => ({ id: value.id, value })))// Row ordering — id-basedgrid.rows.move(employees[0].id, 3) // move that row to position 3grid.rows.reset() // clear custom ordering
Pass-through adapter for API-driven grids — the server owns sort, filter, and pagination. Re-exports the data table’s ServerDataTableAdapter.
Onboard only the rows the server returns for the current page, and set total to the full server-side count. The grid renders that page on every page — onboard page 2’s rows, advance pagination.page, and the grid surfaces them. Because the page window can sit past the locally-held rows, the grid orders the onboarded page in place rather than re-slicing it into emptiness.
ts
Open in Vuetify Bin
Code size: medium
Enable line wrap
Copy code
import { createDataGrid, ServerGridAdapter } from '@vuetify/v0'const grid =createDataGrid({ adapter: new ServerGridAdapter({ total: totalCount, loading: isLoading }),})grid.columns.onboard(columns)// On every page change, clear and onboard the rows the server returned for// that page; keep `total` at the full server count. `grid.clear()` wipes// the row registry — onboarded columns are untouched.grid.clear()grid.onboard(rows.map(value => ({ id: value.id, value })))
createDataGrid composes createDataTable — which owns the data pipeline (filter, sort, paginate) — with four grid modules: column layout, cell editing, row ordering (createSortable), and row spanning. Columns and rows are both onboarded through registries (grid.columns.onboard(...), grid.onboard(...)) rather than passed as options, the same shape as createDataTable. Per-column config (size, pinned, editable, validate, span) rides on each column ticket, so layout, editing, and spanning read it straight off grid.columns and pick up columns onboarded at any time.
Module
Built on
Purpose
table (spread)
createDataTable
Search, sort, filter, paginate, total — all v-modeled through
layout
grid.columns + createGroup
Reads column order and config from the column registry; layers tri-region pinning, percentage sizing, delta-based resize, and visibility (show / hide / toggle / all) on top
A financial data grid with 10 columns that requires horizontal scrolling. Ticker is pinned left, sector pinned right — the center columns scroll independently with drag-to-resize handles.
layout.pinned splits columns into left, scrollable, and right regions with independent sticky offsets so each region scrolls correctly without overlapping. layout.resize(id, delta) adjusts a column and its neighbor inversely to maintain the 100% total width. layout.pin(id, position) moves a column between regions at runtime — the ticker-filter toolbar button demonstrates this. layout.reset() restores the initial sizes, order, and pins declared in columns.ts.
File
Role
data.ts
12 stocks across Tech, Healthcare, Finance, Energy, and Consumer sectors
columns.ts
10 columns with ticker pinned left, sector pinned right
usePinnedGrid.ts
Layout logic — pin/unpin, drag-resize, pixel sticky offsets, and the up/down/volume stats
PinnedToolbar.vue
Market-overview header with the ticker filter and reset
PinnedFooter.vue
Row count plus the left / scrollable / right pin-region summary
An inventory management grid where editing is the primary workflow. Product name, price, and quantity are editable; invalid values show inline errors and block commit. Every committed edit pushes a { from, to } entry onto a createTimeline, which powers the Undo / Redo buttons and the history log.
editing.edit(row, column) activates a cell — the active cell is highlighted so the edit target is unmistakable. editing.commit(value) runs the column’s validate function first; the commit only lands when the validator returns true, and editing.error holds the rejection string until the value passes or the user cancels. The onEdit callback fires after each successful commit and is where useEditableGrid.ts pushes { row, column, from, to } to a createTimeline({ size: 50 }) for history. timeline.undo() and timeline.redo() walk the bounded stack; the handler applies the recovered from (undo) or to (redo) back to the row via grid.upsert.
File
Role
data.ts
8 products across electronics, accessories, and peripherals
columns.ts
All columns editable + sortable, with validate functions
useEditableGrid.ts
Editing state — grid + createTimeline, edit / commit / cancel and undo / redo handlers
A portfolio holdings grid with two levels of row spanning — account spans every holding under an account, and assetClass spans every holding within an account-and-class pair. Spanned cells double as aggregation rows by showing the account or asset-class subtotal alongside the label.
One rowSpanning(item, column) callback in useSpanningGrid.ts resolves both span levels by checking whether the next consecutive row shares the same account (and, for assetClass, the same account-and-class pair). The resulting span map is consumed in the template via spans.value.get(rowId)?.get(columnId), which returns { rowSpan, hidden }. The template skips <td> entirely when hidden is true — the spanning cell above covers it — and sets :rowspan="rowSpan" otherwise. Spans are clamped to remaining visible rows and never cross page boundaries.
File
Role
data.ts
11 holdings across 3 accounts (Wealth, Retirement, Trust) and 4 asset classes (Equities, Bonds, Real Estate, Cash)
Spanning logic — the rowSpanning callback and account / asset-class aggregation helpers
SpanningGrid.vue
The table — multi-level row spans, subtotals in spanned cells, the pinned Today column
Portfolio holdings
Accounts3
Positions11
Portfolio$2,230,000
Account
Asset Class
Ticker
Holding
Value
Today
Wealth Account$1,200,000
Equities$720,000
AAPL
Apple Inc.
$180,000
2.4%
MSFT
Microsoft Corp.
$245,000
1.8%
NVDA
NVIDIA Corp.
$295,000
5.2%
Bonds$300,000
US-10Y
Treasury Note 10Y
$150,000
-0.3%
GS-AAA
Goldman Corp. AAA
$150,000
0.1%
Real Estate$180,000
VNQ
Vanguard REIT
$180,000
0.9%
Retirement$580,000
Equities$400,000
VOO
S&P 500 ETF
$230,000
1.4%
VTI
Total Market ETF
$170,000
1.6%
Cash$180,000
MMF
Money Market Fund
$180,000
0.0%
Trust$450,000
Equities$250,000
GOOGL
Alphabet Class A
$250,000
3.1%
The Account column spans every holding under that account; Asset Class spans every holding within the same account-and-class pair. The grid resolves both spans from a single rowSpanning callback that walks the source order.
Hide and show columns without redistributing the remaining widths — headless, so the consumer rebalances via distribute() or CSS. all surfaces every column (including hidden ones) each carrying a visible flag, which is exactly the shape a column chooser needs.
ts
Open in Vuetify Bin
Code size: medium
Enable line wrap
Copy code
const grid =createDataGrid()grid.columns.onboard(columns)grid.onboard(rows.map(value => ({ id: value.id, value })))grid.layout.hide('email') // exclude from the render setgrid.layout.show('email') // restore itgrid.layout.toggle('email') // flip current visibilitygrid.layout.columns.value // render set — visible columns onlygrid.layout.all.value // every column, each with a `visible` flag
Post-sort row ordering for drag-and-drop reordering. Backed by createSortable, keyed by row id — index-based addressing was dropped because it drifts under reactive churn.
ts
Open in Vuetify Bin
Code size: medium
Enable line wrap
Copy code
const grid =createDataGrid()grid.columns.onboard(columns)grid.onboard(rows.map(value => ({ id: value.id, value })))grid.rows.move(rowId, 3) // Move the row with this id to position 3grid.rows.order.value // Current id sequencegrid.rows.reset() // Clear custom ordering// Ordering resets on sort change by default// Set preserveRowOrder: true to keep ordering across sorts
Use DataGrid when you want the compound markup and ARIA. Use createDataGrid when you own the rendering — custom cells, virtual lists, or onboard of a server page.
createDataGrid composes createDataTable and layers on column layout (pin, resize, reorder, hide), cell editing, row ordering, and row spanning. Use the table when you only need the data pipeline; reach for the grid when you need spreadsheet-style column manipulation or editable cells.
Row ordering resets on sort change by default. Pass preserveRowOrder: true to keep the custom rows.order across sort changes.
Call grid.layout.resize(id, delta) — it grows that column by a percentage and shrinks its neighbor inversely so the columns always total 100%. grid.layout.reset() restores the initial sizes, order, and pins.
grid.editing.commit(value) runs the column’s validate function first — the commit only lands when the validator returns true, and grid.editing.error holds the rejection string until the value passes or the user cancels.
No — grid.layout.hide(id) just drops the column from the render set; rebalancing is left to you via grid.layout.distribute([...]) or CSS. grid.layout.all lists every column with a visible flag, which is exactly the shape a column chooser needs.
Yes. Onboard columns with a children array and read grid.headers — a 2D grid carrying colspan / rowspan for <thead>. The layout and data pipeline still operate on the leaf columns only.
Discord
Need help? Join our community for support and discussions ↗