Data Grid demos
Every demo has a standalone page with its preview, source and notes.
102 demos
Columns
- Column definitions
Fields and header text, px / percent / auto widths with min and max, alignment, typed and formatted values, checkbox display, computed values and overflow modes, declared as
<DataGridColumn>children. - Column types, ids and reading methods
Columns without
typeinfer it from the first non-null value, ids resolve fromid, thenfield, then a generated id with a warning, the same columns work as an array or as<DataGridColumn>children, text that looks like markup stays text, a function template renders rich content, and the column reading methods report ids and visible positions. - Column capabilities, locked and identity columns
Sorting, filtering, search, grouping, editing, resizing and reordering on for the grid and turned off per column with
sortable,filterable,searchable,groupable,editable,resizableandreorderable; alockPositionfirst column and anidentitykey column. - Visibility, resize, reorder and auto-size
Toggle columns through the reactive column
hiddenfield or the API, drag header edges or press Ctrl+Alt+Arrow to resize within the min and max widths, drag headers or press Alt+Arrow to reorder (both opt in withresizableandreorderable), move columns withapi.moveColumn, drive a width reactively, and watch the resize and drag events. - Column fit and computed headers
Switch
resizeModebetween'auto'(columns stretch to fill the grid and a resize re-fits the others) and'normal'(widths are kept and the space stays empty), and compute header text withheaderValueGetter. - Row number column
A
type: 'rowNumber'column numbering 2,000 orders across pages, sorts and groups, with the header group toggle buttons. - Column chooser
The column chooser opened from the toolbar item, from
api.openColumnChooser()or at a viewport point, with a search box, a configurablesearchOperator, theconfirmandimmediatemodes, and a column kept out of the list withhideable: false. - Column chooser templates
The toolbar column chooser with stacked header groups, accent-insensitive debounced search, a header line, a custom footer action, and
openColumnChooser({ x, y }).
Frozen Rows and Columns
- Pinned columns and sticky rows
Columns pinned to the start or end, or fixed in place (
pinned: 'center'), by definition, by the reactivepinnedColumnscount or at runtime from the column menu, Alt+Shift+Arrow keys andapi.pinColumn, plusstickyRowsandstickyBottomRowsover 2,000 virtualized rows. - Pinned rows
Rows pinned by
isRowPinnedand at runtime withapi.pinRows/api.unpinRowsstay in the sticky top zone of 2,000 virtualized orders, follow sorting, filtering and search, and stay outsidepageSize.
Stacked Headers
- Stacked headers
Three header levels from nested
columns, with groupheaderAlign,headerPropsandrenderHeader; leaf sorting, filtering, resizing and reordering within the parent group; a pinned leaf beside the groups; and the column chooser listing the hierarchy.
Row and Column Spanning
- Row and column spans
A weekly schedule with
rowSpan: trueon a pinned column, an explicitcolSpanfunction, and the gridmergeCellsswitch for merging equal adjacent values by rows, columns or both, witharia-rowspanandaria-colspanon merged cells. Merged cells are one focus stop: arrow keys skip covered cells, box selection covers whole spans, and cell editing edits the span's anchor cell.
Column Resize, Reorder, Chooser, Menu
- Column menu
The header menu with every built-in item (sort, clear sort, filter, group, auto-size, pin, column chooser) in a custom order, a checkbox item and a submenu, per-column items through
onBeforeColumnMenuOpen,column.menu: false, andonColumnMenuItemClick.
Context Menu
- Context menu
Right-click (or Shift+F10) a header, cell or the pager over 5,000 rows with a pinned column; the default per-target menus or a custom list with built-ins, a submenu and a custom action; per-target items and cancelation in
onBeforeContextMenuOpen; disabled export items with a reason.
Toolbar
- Toolbar
Built-in items (search, column chooser, expand and collapse all, export, print), built-ins with a custom label, custom items with reactive
disabled, a centered customrenderitem, the overflow menu at a narrow width,renderToolbar, andonToolbarItemClickwithpreventDefault().
Templates
- Cell and header templates
Function templates for cells and headers, per-cell attributes and classes, and per-row and per-cell hooks that run only for rendered rows.
- Row template with virtualization
A row template over 20,000 virtualized rows that keeps ARIA row and gridcell semantics; unshipped orders are flagged.
- Filter, pager and empty templates
A column
renderFilterin the filter menu, arenderPagerpager and arenderEmptymessage for "no data" and "no match", all defined once at module scope.
Virtual Scroll
- 100,000 rows × 100 columns
Row and column virtualization with a sticky header, overscan settings, a smaller row height, percent widths under column virtualization, and scroll-to-row/column.
- One million rows
36 million pixels of rows exceed the browser's element height limit; scaled scroll mapping keeps every row reachable. The grid fills a fixed-height parent.
- Wrapped text and measured row heights
Text wrapping for headers, content or both, with measured variable row heights under row virtualization.
- Skeleton rows
50,000 remote orders read in blocks with 800 ms of latency. With virtualization.skeletonRows the unloaded rows render shimmering skeleton bars until their block lands; turned off they show the loading text. The jump buttons scroll by offset with api.scrollTo.
- Spans, cell ranges and keyboard under virtualization
100,000 rows by 101 columns with pinned start and end columns, a merged Block column whose row spans run through the virtualized rows, cell range selection across unrendered rows, and Ctrl+Home / Ctrl+End to unrendered corners.
- Column features under column virtualization
2,000 rows by 81 columns under stacked headers with column virtualization on; resize, reorder, autofit, grouping from the column menu, batch editing, the fill handle, detail rows, copy and print reach columns that were never rendered.
Performance
- Render counts
The dev-only __SALMON_UI_DEVTOOLS__ hook counts what each interaction re-renders - nothing for a parent re-render with stable columns, only the touched cells for focus and selection.
Theming and Appearance
- Theme colors and contrast
The five semantic color seeds and the color scheme are the whole theme input; the derived palette keeps text, border, focus and selection contrast for any seed, checked live below the grid.
- Theme density
The same buttons, text field, select, date picker, tabs and Data Grid under density default and compact side by side, with the measured control, row and header heights.
- Theme surfaces
A SidebarLayout with a near-black sidebar surface, a white app bar surface and a primary-colored Data Grid header, on a teal-tinted neutral ramp, all from one theme object.
- Grid lines, striping, row height and theme
Grid line modes, alternate rows, hover highlight, fixed and conditional row heights, row and header size props in place of size modes, text wrap, className/style passthrough, and the colors-only theme with light, dark and auto schemes.
- Custom icons
The grid draws built-in SVG icons with CSS; the icons prop replaces sort, filter, column menu, group, pager and menu icons with your own nodes, rendered on the server and hydrated without a mismatch.
Selection
- Row selection
Single and multiple row selection, the
type: 'selection'checkbox column with select-all, checkbox-only and replace-on-row-click modes, toggle, additive clicks, persistence across filtering, cancelable changes and the selection methods. - Cell and column selection
Cell and row-plus-cell modes, flow and box cell ranges, column selection, keyboard selection and range selection across virtualized rows and columns.
- Range fill
Drag the fill handle (or call
api.fillSelection()) to tile the selected cell range over 5,000 virtualized rows, including rows far outside the rendered window, with undo.
Sorting
- Sorting
Header click cycles ascending, descending and unsorted; multi-column sort (switchable with
sorting.multiple) with order badges and aria-sort; a Multi-sort toggle popup on touch header taps; sorting from the column menu; a stable sort; an initial sort; a custom comparator; a non-sortable column; sort methods.
Filtering
- Filter row
A filter row with operator prefixes and wildcards, an operator dropdown, Enter or while-typing triggers, case and accent switches, a cell template, a lookup column filtered by its display text, initial and nested AND/OR filters, filter methods and a non-filterable column.
- Filter menus
Menu, checklist and Excel filter UIs with typed value editors, a per-column UI and operator list, a custom menu editor, a custom filter comparer, checklist search, Select All, blanks and counts, and a checklist that loads 50 values at a time, plus the filter menu open events with a cancellable before-event.
- Filter builder
The advanced filter builder dialog over nested AND/OR filter groups, opened from the toolbar item or
api.openFilterBuilder(), with hidden columns offered throughincludeHidden, a cancellableonBeforeFilterBuilderOpenand filter events reportingui: 'builder'. - Filter status and filtered rows
The pager's filter status message for the filter row (on by default, switchable with filtering.showStatus) and getFilteredRows() reading the filtered rows across every page.
- Server-side filtering and search
A remote JSON source receiving the filter row (with an initial nested AND/OR group), the toolbar search and the page in one request, and an Excel filter whose values come from paged, searchable facet requests (with a skeleton or spinner while they load); the request log shows the wire query.
Searching
- Search
The toolbar search box over the
searchprop, with an initial text, the operator (includingwildcardandlikepatterns), the searched columns, case and accent switches, highlighted matches, a non-searchable column, search methods and events.
Paging
- Paging
The pager with an initial page, page buttons, a page size dropdown, keyboard navigation, localized text, a narrow layout, a custom pager, page methods, the page size that fits a height (getPageSizeForHeight) and cancelable page events.
- Paged groups and aggregate scope
400 orders grouped by country and paged 25 data rows at a time;
aggregateScopeswitches the footer and group footers between the current page and every row. - Cursor paging
Remote paging with cursors instead of offsets; each page request carries the cursor the server returned with the previous page.
- URL-synced paging
Server paging without a reported total (
paging.totalRowCount), the page kept in the query string (paging.syncUrl),onViewChangeonce per page, and arenderErrorstate with retry.
Grouping
- Grouping
Multi-level grouping over 5,000 virtualized rows with the drop area, chips, group-by-format, a custom group key, caption templates, collapse state, cancelable changes, group methods and events.
- Grouping with column virtualization
20,000 rows by 80 columns grouped by two levels with row and column virtualization on; the group indent and captions stay at the start edge while scrolling sideways.
Editing
- Editing
Inline row, batch, dialog and cell editing with the built-in editors, a command column, validation messages, edit marks, confirm prompts, the unsaved-changes guard and undo.
- Edit methods and events
The editing capability flags, newRowPosition, tabToNextRow, read-only columns and isCellEditable, every edit method on the Data Grid instance and every edit event in a log.
- Saving to a server
Batch saves go to dataSource.write as one request with added, changed and deleted rows; a simulated server rejects some cells or fails, and the grid keeps the drafts with the server errors.
- Batch editing over 100,000 rows
Batch mode with row virtualization; drafts survive scrolling, and group captions stay read-only when the rows are grouped.
- Always-visible add row
editing.showNewRow keeps a blank add row at newRowPosition; Enter saves it and a fresh one follows.
Validation
- Validation rules
Every built-in rule, an async custom validator, per-rule and localized messages, a row-level rule, and validateBatch in batch mode.
Clipboard
- Copy and paste
Copy a cell range, the selected rows or the focused cell as TSV, with or without headers; paste TSV into batch drafts, skipping read-only cells; raw and display-text copies;
onBeforeCopy/onBeforePastechanging or cancelling the text.
Aggregates
- Aggregates
Footer, group footer and group caption aggregates over 20,000 virtualized rows; several types per column, two aggregate rows, a custom aggregate, formats, function templates, and recomputation on filter.
Lazy Load Grouping
- Lazy load grouping
Two-level grouping over 50,000 remote orders. The server returns group captions with their aggregates first; children load in chunks of 50 when a group expands, with a per-group loading state and a Load more button for the next chunk; with infinite scrolling on, scrolling near the end of a group's loaded rows appends the next chunk; paging pages the countries in the root request; a filter change reloads loaded groups and keeps expansion.
Infinite Scroll
- Infinite scrolling
50,000 remote orders read in blocks of 100 as the viewport approaches unloaded rows. The first 300 rows are seeded with initialResult and render on the server; unloaded rows show loading rows; with cache and maxBlocks 6 the farthest blocks are evicted; sorting resets to the top; a button loads the next block; another adds an order at the bottom, which lands after the last row.
Data Binding
- Remote JSON data source
50,000 orders from a Salmon UI JSON protocol endpoint (the reference handler, behind a Next.js route handler or in the browser on the static site), loaded in infinite blocks, sorted on the server with an initial sort.
- OData bridge transport
A user-written transport maps Salmon UI protocol reads to an OData-style GET ($orderby, $skip, $top, $count, $select) and the OData body back to tuples; the same pattern bridges Web API, OData and GraphQL backends.
- Remote editing
Batch edits, additions and deletions saved to a remote source as one protocol write request; a failed write keeps the pending changes.
- Offline data source
Loads a fetched array once and runs sorting and filtering locally.
- Live data stream
A snapshot plus a stream of upsert patches applied by row id without a full refresh; sorting stays live.
- Silent cell and row updates
setCellValue and setRowData change one cell or one row in place without the edit lifecycle and without a full refresh; only the touched row re-renders.
- Controlled data operations
The grid hands each query to the application, which runs it and returns rows (onQueryChange), and each save, which the application persists (onDataChange); the serialized query and the writes are shown.
- Empty state
renderEmpty tells an empty data set (noData) from a query without matches (noMatch); without it the grid shows localeText.noRows.
- Loading indicator and refresh
The spinner or skeleton overlay while a slow source loads, renderLoading with its initial, page and refresh phases, setLoading(true/false), and refresh() re-reading the data with the current query.
Methods and Commands
- Data Grid API and keyboard hooks
The imperative grid instance - focus a cell, scroll to a row or to an offset (scrollTo), read view rows, the primary-key fields, the data source, cells, row info and the focused cell - plus a rebound key and a custom key handler.
- Engine, modules and commands
Part elements of the rendered grid, a one-cell subscription on the core engine, a custom core module with its own command and pipeline stage, a recorder that replays serializable commands, and disposing a standalone engine.
Events
- Data Grid events
onReady on every mount, a cancellable before-event pair, headerProps, and selection, resize, column drag, column menu and context menu events in one on-page log.
- Row and cell click events
onCellClick, onRowClick, onCellDoubleClick and onRowDoubleClick with the row, the column and the cell value; preventDefault() skips the built-in selection or edit start.
State Persistence
- State persistence
A grid with an id and persistState saves sorting, filters, paging, column order and widths to localStorage and restores them after a reload; buttons read, restore, reset and serialize the state.
- Named saved views
Save the current sort, filters, grouping, page and column layout under a name, switch between saved views, and delete them; views are stored in localStorage with createSavedViews and applied with restoreState.
- Controlled grid state
The application owns the sort, filters, search, page, hidden columns and selection through reactive props and change events, takes a getState() snapshot and restores it without recompiling columns.
Globalization and Localization
- Traditional Chinese admin page
An order admin page under one LocaleProvider with the built-in zh-TW pack (data grid, pager, date pickers, dropdowns, form validation, file upload, tabs, breadcrumbs, dialogs and toasts), switchable to the built-in English text.
- Localization
One grid switched at runtime between English, German (a complete localeText catalog, de-DE formats, EUR) and Arabic (ar-EG formats, EGP, dir auto turns it right to left) without remounting.
- Custom format patterns
Number patterns (
#,##0.00,0.0##, quoted literals,%, zero padding), date patterns with quoted text, a skeleton object, andformatValuein a cell template, switched between locales. - Accent and case matching
Search and filter-row matching with
matchCaseandignoreAccents, so "rene" finds "Renée" and "zoe" finds "ZOE" and "Zoë". - Date picker and first day of week
The
dateanddatetimeeditors open an accessible calendar whose weekday names, week start and month heading follow the gridlocale, with afirstDayOfWeekoverride.
RTL
- Right-to-left
An RTL grid with 30 virtualized columns - mirrored layout and pinned zones, flipped arrow keys, mirrored resize handles and drag indicators, and normalized horizontal scrolling.
Accessibility
- Keyboard and screen reader
One labelled
role="grid"tree over 2,000 virtualized rows - the keyboard map, a single tab stop, live-region announcements mirrored below the grid, and focus that survives virtualization and menus.
Adaptive UI
- Adaptive UI
Adaptive mode as a container query on the grid's own width, vertical card rows over the same virtualized row window, full-screen sort, filter, column chooser and edit sheets, bottom-sheet menus, touch long-press, native swipe scrolling and the multi-select toggle, and 44 px targets.
Foreign Key
- Lookup columns
Two local lookup (foreign-key) columns - cells hold keys and show names; sorting, filtering, search and grouping run on the display text; the lookup columns are listed from api.getColumns().
- Remote lookup
A lookup column backed by a cached @salmonui/data createLookup source with a simulated 900 ms server; the missing keys load in one batched request while the header shows the load status.
Export and print
- Export and print
Excel, PDF and CSV export of 10,000 grouped rows with stacked headers, aggregates, lookup text, templates, hidden columns, selected rows, detail blocks, a second grid in the same workbook, an embedded PDF font and a server export route; writers load on demand; print of every row of the scope.
Detail Template
- Detail rows
A detail row under each expanded order of 10,000 virtualized rows, with an async loader, rows without a detail, expand-all and toggle events.
Hierarchy Grid
- Child grids
A three-level hierarchy grid (customers, orders, items) joined by field, with inherited locale, sortable child grids and lazy mounting.
- Hierarchy print and export
Print and Excel export of a hierarchy grid and of detail template rows with the hierarchy modes expanded, all and none.
Tree Grid
- Tree basics
A nested project plan in DataGrid tree mode with the tree column toggle, expand and collapse methods, tree keys, cancelable toggle events, sibling sorting and child summary rows.
- Tree templates
An org chart in DataGrid tree mode with a tree column cell template that reads ctx.tree, row props and classes per depth, a row template that keeps the toggle, detail rows that follow their tree row, row spans inside each parent, and grid lines and alternate rows.
- Tree expansion state
Flat ticket rows with initial expansion from a data field, reactive expandedRows overrides, expansion saved with persistState and getState / restoreState, an orphan and a parent cycle shown as roots, shared grid events, and tree mode winning over a grouping prop.
- Tree filtering and paging
Flat self-referential rows (parentIdField) with a filter row, the four tree filter modes, sibling sorting and paging by visible rows or by root rows.
- Tree aggregates and filters
A flat budget tree with footer aggregates of several types and templates, child summary rows, Excel and checklist filters whose value lists count rows of every depth, expansion that survives sorting, filtering and paging, and the tree row info methods.
- Tree checkbox cascade
Checkboxes in the tree column whose state is the row selection, with self, hierarchy and filtered hierarchy cascade modes and tri-state parents.
- Tree drag and indent
Flat tree rows reordered by drag (before, after or into a row), the indent and outdent toolbar items, methods and keys, new rows above, below or as a child of the focused row, and subtree delete.
- Tree drag to other targets
Rows of a nested backlog tree dragged into another tree grid (before, after or into a row) or onto a custom archive element, with each parent's subtree travelling along in the drop payload.
- Tree lazy children
A remote tree whose children load on expand through read({ parentRowId }), with the per-row load status, a failed child read reported by onError and a retry.
- Tree data sources
One catalog tree over five data sources - an offline source that loads once, a controlled source that answers each read by parentRowId with paged roots, nested envelopes that load whole subtrees, the @salmonui/data JSON source over the reference server handler with server filtering and aggregates, and infinite scroll over blocks of root rows with skeleton rows.
- Tree export, print and copy
A bill of materials in tree mode exported to Excel with outline levels, CSV with a depth column and PDF with indentation, either the expanded rows or every row, a server export of the same tree and state, print with indentation, and copy that adds ancestors or descendants.
- Tree RTL, locale and adaptive
An office tree in right-to-left mode with mirrored indentation, chevrons and keys, German localeText for the tree strings, locale number, currency and date formats, a lookup column and validation while editing, and adaptive cards that show the toggle and the level.
- Large tree
A 28,208-row sales tree with 24 month columns under stacked year headers, row and column virtualization, cascading checkboxes, batch editing across scrolled-out rows, and resize, reorder, pin, column menu and chooser on a tree.
- Tree performance
Generate the 50,000-row or the 1,000,000-row benchmark tree and read the measured time of grid creation, expand and collapse, a 100,000-row cascade, sibling sort, an ancestors filter, indent and outdent next to the tree mode release budgets.
Row Drag and Drop
- Row drag and drop
Reorder rows by the drag handle or the keyboard, drag the selected rows together, and move rows into a second grid, with cancelable drop events.
- Drop targets and persisted order
A ranked list whose drops write new rank values through dataSource.write, and an inbox whose rows drop onto a custom archive element.