# Blazor Data Grid (DataGrid, Table)

URL: https://flexcoreui.com/demo/grid  
Section: Data Grid  
Controls: GridControl, GridColumn, GridColumnsBase  
Keywords: datagrid, data grid, grid, data table, datatable, Blazor grid

A Blazor data grid users can search, sort, filter, group and freeze, with only the visible rows rendered; try it on 4,009 real airports.

## Documentation

### Data

| Name | Type | Default | Description |
|---|---|---|---|
| DataSource | IEnumerable<TValue>? | null | The rows to show, enumerated for display, filtering, sorting and export. Cannot be set together with ItemsProvider. |
| ChildContent | RenderFragment? | null | Holds the column definitions. Rendered hidden inside a cascading IGridOwner so each GridColumn registers itself with the grid. See Column sets. |

### Layout

| Name | Type | Default | Description |
|---|---|---|---|
| Height | string? | null | CSS height of the grid. A bounded height makes the body the scroll container and is required by row windowing and ItemsProvider; without one a local source larger than AutoPageRowThreshold falls back to paging. |
| Width | string? | null | CSS width of the grid host; blank leaves the width to the container. |
| WidthMode | GridWidthMode | GridWidthMode.FillAvailable | FillAvailable stretches the table to the container and overflows only when the columns need more; FitColumns keeps every column at its own width, so the table may end short of the container or scroll horizontally. |
| EnableViewportSafeSizing | bool | true | Wraps a pixel, viewport or calc Height or Width in min() with the matching viewport-safe limit when it could exceed it; percentages pass through unchanged. |
| ViewportSafeMaxWidth | string | "" | Upper bound applied to Width by viewport-safe sizing; blank applies none. |
| ViewportSafeMaxHeight | string | "" | Upper bound applied to Height by viewport-safe sizing; blank applies none. |
| ExtendVerticalScrollbarIntoHeader | bool | false | Adds the fx-grid-vscroll-header-gutter class, a header-height scrollbar gutter so the vertical scrollbar appears to start at the header rather than at the first data row. |
| ShowHeader | bool | true | False skips the thead entirely, including header bands and the filter row, and reports zero header rows to assistive technology. |

### Context menu

| Name | Type | Default | Description |
|---|---|---|---|
| OnContextMenu | EventCallback<MouseEventArgs> |  | Raised from the grid host's contextmenu event; attaching a handler also suppresses the browser menu. |
| PreventDefaultContextMenu | bool | false | Suppresses the browser context menu on the host even with no OnContextMenu handler and no cell context menu. |
| StopContextMenuPropagation | bool | false | Stops the contextmenu event from bubbling past the grid host. |

### Rows

| Name | Type | Default | Description |
|---|---|---|---|
| RowHeight | int | 0 | Fixed row height in px; 0 lets rows size to content, and row windowing then measures them. Never resolves below MinRowHeight. |
| AllowRowResizing | bool | false | Shows a drag handle on the last data cell so users can resize rows; a resized height overrides RowHeight. Incompatible with ItemsProvider and turns off fixed-pitch row windowing. |
| AllowRowReorder | bool | false | Shows a row-header drag handle for moving rows to a new position; hidden while the grid is grouped. |
| RowReorderPredicate | Func<TValue, bool>? | null | Per-row gate for the reorder handle; null shows it on every row. |
| ShowRowSelectorHandle | bool | false | Shows a narrow row-selector handle column, grid chrome rather than a data column; hidden while the grid is grouped. |
| RowSelectorHandleShape | GridRowSelectorHandleShape | GridRowSelectorHandleShape.HalfButton | Look of the handle: HalfButton, Button, CheckBox or Flat. It sets the handle's size, border, radius and background, and Flat adds fx-row-selector-cell-flat to the cell. |
| RowSelectorHandleWidth | int | 18 | Width of the handle column in px, clamped to 12-40. |
| RowSelectorHandlePredicate | Func<TValue, bool>? | null | Per-row gate for the selector handle; null shows it on every row, and a predicate that throws hides it. |
| RowSelectorHandleEmphasisPredicate | Func<TValue, bool>? | null | Marks rows whose selector handle draws emphasized; null emphasizes none. |
| MinRowHeight | double | 16 | Floor in px for every resolved row height: RowHeight, RowHeightSelector results and user resizes. |
| RowHeightSelector | Func<TValue, int, double?>? | null | Per-row height in px, called with the item and its resolved row index; null or a non-positive result falls back to RowHeight. Incompatible with ItemsProvider. |
| RowCssClassSelector | Func<TValue, int, string?>? | null | Extra CSS class for a data row, called with the item and row index. |
| RowExportStyleSelector | Func<TValue, int, GridExportCellStyle?>? | null | Row style applied when exporting to Excel or HTML, called with the item and row index. See Export & templates. |
| CellExportStyleSelector | Func<TValue, string, int, GridExportCellStyle?>? | null | Cell style applied when exporting, called with the item, field and row index. See Export & templates. |
| RowTooltipSelector | Func<TValue, int, string?>? | null | Text for the data row's title attribute, shown wherever the pointer rests on the row; a cell with its own title keeps it. Null or empty adds none. |

### Editing

| Name | Type | Default | Description |
|---|---|---|---|
| CellEditablePredicate | Func<TValue, string, bool>? | null | Per-cell edit gate, (item, field), checked on top of the column's AllowEditing at every edit start, mass-edit target and editable render cue; blocked cells are skipped silently. See Batch editing. |
| BatchEditBehavior | GridBatchEditBehavior | GridBatchEditBehavior.MultiRow | MultiRow: a click opens the editor and typed values can fan out to every selected row. SingleCell: click selects, double-click edits, and typing commits to that one cell. See Batch editing. |
| EditOnSingleClick | bool | false | Opens an editable batch cell on a plain click instead of click-to-select, type-to-replace. See Batch editing. |
| TextEditorTypingBehavior | TextBoxTypingBehavior | TextBoxTypingBehavior.ServerBacked | Transport for the generated text cell editors: ServerBacked or ClientBuffered. See Typing modes. |
| UseClientBufferedTextEditing | bool? | null | Overrides TextEditorTypingBehavior: true forces client-buffered editors, false server-backed, null follows the mode. See Typing modes. |
| AllowSingleCellColumnMassEdit | bool | false | In SingleCell mode, lets Ctrl/Cmd and Shift select several cells of one column and commits the typed value to all of them. See Batch editing. |
| AllowCellFormulas | bool | false | Evaluates text cell values that start with = as row-scoped formulas when building display values, and bypasses the display-value cache. Column Formula values are evaluated regardless. See Dynamic columns. |

### Sorting

| Name | Type | Default | Description |
|---|---|---|---|
| AllowSorting | bool | false | Master switch for header-click sorting, the sort items in the header menu and the Sort dialog; each column's own AllowSorting must also be true. |
| AllowMultiSorting | bool | true | Allows several sort levels through the Sort dialog; header clicks still sort one column. Requires AllowSorting. |
| ShowMultiSortMenu | bool | true | Shows the Custom Sort entry in the header right-click menu when both sorting switches are on; false hides it while keeping multi-column sorting available. |

### Filtering

| Name | Type | Default | Description |
|---|---|---|---|
| AllowFiltering | bool | false | Master switch for the header filter icon, the filter-bar inputs, the header menu's filter items and the expression-filter button; the column's own AllowFiltering must also be true. |
| EnableAdvancedFilterPopup | bool | false | Adds a second condition (Condition 1, AND/OR, Condition 2) to the column filter popup, honored by local and provider filtering. |
| EnableBlankRowFilter | bool | false | Adds (Blanks) and (Non-Blanks) quick filters to the column filter popup. |
| ClearFiltersOnDataSourceChange | bool | true | Clears all transient filter state when a different DataSource instance arrives, so one context's filter cannot hide another context's rows. |
| ShowHeaderFilterIcon | bool | true | Shows the clickable filter icon in each filterable header; turn it off when the grid already renders filter-bar inputs. |
| HeaderFilterIcon | string | string.Empty | Glyph or text for the header filter icon; blank renders the built-in glyph. |
| ShowSearchBar | bool | false | Adds a search box to the built-in toolbar, which then renders, keeping rows whose text in any visible column contains the typed value; applied as you type or on commit. |

### Paging

| Name | Type | Default | Description |
|---|---|---|---|
| PageSize | int | 50 | Rows per page; PageSettingsRef.PageSize takes precedence when a settings component is present. See Scroll vs paging. |
| PageSizes | int[] | [25, 50, 100, 200] | Choices in the pager's page-size list; PageSettingsRef.PageSizes wins, and an empty array falls back to the built-in set. See Scroll vs paging. |
| PageButtonCount | int | 5 | Number of page buttons the pager shows; PageSettingsRef.PageCount wins, and a non-positive value falls back to 5. |
| AutoPageRowThreshold | int | 10000 | With AllowPaging off and no Height, a local source with more rows than this switches to paging on its own; 0 or less disables the switch. |
| AllowPaging | bool | false | Turns the pager on. Off, paging still engages for an unbounded-height grid above AutoPageRowThreshold. See Scroll vs paging. |

### Selection

| Name | Type | Default | Description |
|---|---|---|---|
| CellSelectablePredicate | Func<TValue, string, bool>? | null | In cell selection mode, an (item, field) gate shared by pointer, range and keyboard selection; cells it rejects are pruned from the selection and skipped when the grid looks for its first and last cell. Null leaves read-only cells selectable. |
| AutoSelectFirstRow | bool | false | Selects and focuses the first visible row when a selectable row grid first receives rows and after a sort reorders them; ignored for checkbox-only and cell selection. See Master-detail. |
| InitialSelectedRowIndex | int? | null | Displayed-row index to select before the first visible render, for pickers that already know their value; re-applied when the index or the data source changes. See Master-detail. |
| FocusInitialSelection | bool | false | Gives the initial selection keyboard focus once its browser reveal has completed. |
| NotifyInitialSelectionChanged | bool | false | Raises the normal selection-changed callback for the seeded initial selection; pickers usually leave it false because nothing changed. |
| InitialSelectionReady | EventCallback |  | Fires after the seeded row has rendered and its browser reveal has completed; a first-paint readiness gate for picker hosts. |
| AllowSelection | bool | true | False makes the grid cursor-only: clicks and keys move the active cell and editing still works, but no row or cell is ever selected and no selection event fires. See Master-detail. |
| HighlightSelectedRows | bool | true | Applies fx-selected and the data-fx-row-highlight flag to selected rows; false keeps the selection but draws nothing. See Master-detail. |
| ShowActiveCell | bool | true | False hides the cell cursor (the host gets data-fx-active-cell of hidden) and turns off the browser-side navigation preview; the active cell still exists as keyboard origin and scroll anchor. |
| AllowRowDragSelection | bool | true | Lets a primary-button press on a row start spreadsheet-style drag selection in multi-select row grids; click selection is unaffected. |
| CommitSelectedRowOnEnter | bool | false | Plain Enter on the focused grid with one selected row, no open editor and no open popup invokes OnRecordDoubleClick for that row, so a picker accepts with Enter. |
| ShowSelectionInfoBar | bool | false | Shows the rows-selected banner with its Clear Selection button above the header whenever more than one row, or any cell, is selected. |
| TypeAheadTargetField | string? | null | Field that receives multi-row type-ahead when no selection gesture has captured an editable target column. |
| TypeAheadFallbackField | string? | null | Alias for TypeAheadTargetField; used only when that one is blank. |
| ShowRowSelectionEditColumnCue | bool | false | In multi-row selection, highlights the column that bulk type-ahead will write to across the selected rows, and lets such a column be captured as the target. |

### Keyboard

| Name | Type | Default | Description |
|---|---|---|---|
| TabNavigationMode | GridTabNavigationMode | GridTabNavigationMode.WrapRows | Tab and Shift+Tab inside a cell: WrapRows walks the cells and wraps between rows, WrapRowsUntilEdge stops at the grid's edges, PageControl hands both keys to an enclosing PageControl graph. See Page navigation. |
| HostTabIndex | int? | null | tabindex of the grid host element; null renders 0. |
| SeedActiveCellOnHostFocus | bool | false | When the host gains focus with no active cell, makes the first visible cell current so arrows, Tab and type-to-edit work at once; entry through page navigation seeds regardless. |
| ExitGridOnTerminalTab | bool | false | Tab on the last navigable cell and Shift+Tab on the first move focus to the adjacent control outside the grid instead of wrapping. |
| AutoFocusFirstCell | bool | false | Makes the first cell current and focuses the grid on open, retried for up to three renders while rows arrive; stops once a cell is current. |
| EnterAdvancesToNextCell | bool | false | Enter in an open editor commits and moves to the next editable cell, wrapping rows, like Tab; Shift+Enter commits in place. |
| EnableTypeSearch | bool | false | Read-only type search: printable keys typed into the focused grid find the first row whose text in the active column starts with the buffer, and the matched prefix is highlighted in that column. |
| TypeSearchDelaySeconds | int | 3 | Seconds of inactivity before the type-search buffer resets; values below 1 count as 1. |

### Columns

| Name | Type | Default | Description |
|---|---|---|---|
| AllowGrouping | bool | false | Enables grouping: the group drop area, header drag-to-group, the header menu's group items and grouped row rendering. See Grouping & totals. |
| AllowResizing | bool | false | Shows column resize grips and enables drag resizing; the column's own AllowResizing must also be true. |
| AllowColumnAutoFit | bool | true | Best fit: double-clicking a resize grip sizes that column to its content, and the header menu offers Best Fit and Best Fit All Columns. The grip needs AllowResizing. |
| AutoFitSampleSize | int | 50 | How many rows of the current view a best fit samples; values below 1 count as 1. |
| AutoFitEveryRow | bool | false | When the sample also covers every row in view, a best fit measures the display text of every row, including rows outside the rendered window, instead of only the sampled rows. |
| AutoFitMinWidth | double | 40 | Floor in px for a best-fit width; a column's own MinWidth wins. |
| AutoFitMaxWidth | double | 0 | Ceiling in px for a best-fit width; 0 uses the grid's own ceiling, and a column's own MaxWidth wins. |
| AutoFitWidthScale | double | 1 | Multiplier applied to the measured content width before the bounds are applied; values below 1 count as 1. |
| AutoFitUseDomMeasurement | bool | true | Measures rendered text widths through the DOM; false, or an unavailable measurement, falls back to the character-count estimate. |

### Appearance

| Name | Type | Default | Description |
|---|---|---|---|
| SelectedRowBackground | string | string.Empty | Sets --fx-grid-selected-row-bg on the host; blank leaves the theme's value. |
| SelectedRowForeground | string | string.Empty | Sets --fx-grid-selected-row-color on the host; blank leaves the theme's value. |
| SelectedRowHoverBackground | string | string.Empty | Sets --fx-grid-selected-row-hover-bg on the host; blank falls back to the selected-row background. |
| RowHoverBackground | string | string.Empty | Sets --fx-grid-row-hover-bg, the hover background of unselected rows; blank leaves the theme's value. |
| ShowRowCountInFooter | bool | false | Shows the filtered row count: a footer line when not paging, or inside the pager when paging. |
| EnableHover | bool | true | Adds fx-hover to data rows so they highlight under the pointer. |
| EnableAltRow | bool | true | Adds fx-alt-row to every second data row. |

### Toolbar

| Name | Type | Default | Description |
|---|---|---|---|
| Toolbar | List<string>? | null | Names of the built-in toolbar buttons, rendered in order. add, edit, delete, csv, excel and pdf run their built-in action; every click also reaches OnToolbarItemClick. |
| ShowGridToolbar | bool? | null | Forces the toolbar on or off. null shows it when Toolbar has items, ShowSearchBar is on or a GridToolBarTemplate is set. |
| OnToolbarItemClick | EventCallback<string> |  | Fires with the item name after the built-in action for that toolbar button has run. |
| GridToolBarTemplate | RenderFragment? | null | Extra content appended inside the toolbar after the buttons and the search box; setting it makes the toolbar render. |

### Options rail

| Name | Type | Default | Description |
|---|---|---|---|
| ShowAdvancedViewToggleButton | bool | false | Adds a toggle in the group strip that hides the expression-filter button and the options rail until the user switches to the advanced view. The toggle only renders when one of those tools is configured. |
| DefaultAdvancedView | bool | false | Initial state of the advanced view when ShowAdvancedViewToggleButton is on; read once, after that the toggle owns it. |
| ShowExpressionFilterButton | bool | false | Shows the expression-filter button in the group strip; needs AllowFiltering. |
| ShowGridOptionsRail | bool | false | Renders the side rail; it also needs columns and at least one of the rail buttons below. |
| ShowColumnOptionsButton | bool | false | Column options button on the rail, which opens the column panel. |
| ShowFilterPanelButton | bool | false | Declared, but never read; column filtering lives in each column header popup. |
| AllowPivoting | bool | false | Lets the grid switch into the embedded pivot view; turning it off while in pivot mode returns the grid to its rows. |
| ShowPivotPanelButton | bool | false | Pivot button on the rail; also needs AllowPivoting. |
| ShowGridThemeToggle | bool | false | Theme button on the rail, which opens the Theme panel where the user picks one of the GridTheme schemes. |
| Theme | GridTheme | GridTheme.Default | Initial color scheme; read once, after which the Theme panel owns the active scheme. |
| ShowGridBackButton | bool | false | Back button on the rail that leaves the pivot view and closes the open panel. |

### Grouping

| Name | Type | Default | Description |
|---|---|---|---|
| ShowExpandAllButton | bool | true | Declared, but never read. |
| ShowCollapseAllButton | bool | true | Declared, but never read. |
| GroupColumns | List<string>? | null | Fields grouped on load; a new list replaces the live group descriptors on the next parameter set. See Grouping & totals. |
| GroupHeaderTextSelector | Func<string, string, IReadOnlyList<TValue>, string>? | null | Called with the field, the raw key and the group's items to produce the group header text; a blank result falls back to the key. Collapse state still keys on the raw value. |
| FocusGroupHeaderOnContextMenu | bool | false | Makes a right-click on a group header the current group before the context-menu event bubbles, so a host handler can read GetCurrentGroup(). |
| AggregateRows | List<AggregateRow>? | null | Aggregate definitions computed per group and for the grid footer; the tables below describe AggregateRow and AggregateColumn. With an ItemsProvider the fields and types travel as query aggregates instead. See Grouping & totals. |
| ShowGroupExpandCollapse | bool | true | While groups exist, shows the expand-all/collapse-all toggle and the clear-all-grouping button in the group strip. |
| HideGroupedColumns | bool | true | Removes the grouped fields from the visible columns and renders a placeholder column of the same width for each of them. |
| ShowGroupCount | bool | false | Appends the item count to each group header row. |
| DefaultGroupsCollapsed | bool | false | Starts every group collapsed; applied once on the first parameter set, after which the user's expand and collapse actions own the state. Provider groups honor it too. |
| GroupedColumnColor | string | "" | CSS color for the grouped value: the header text falls back to it when GroupItemTextColor is empty, and a 12 percent tint of it feeds the --fx-grid-group-color-soft chip background. |
| GroupItemTextColor | string | "" | Text color of the grouped value on group header rows; empty falls back to GroupedColumnColor. |
| GroupTotalTextColor | string | "" | Text color of group aggregates: caption totals, header-row totals and footer totals. Empty keeps the stylesheet colors. |
| GroupExpandIconStyle | GroupExpandIconStyle | GroupExpandIconStyle.PlusMinus | Built-in expand/collapse glyph preset for group headers, PlusMinus or Triangle; it picks the glyph pair, the CSS class and the inline style unless the overrides below replace them. |
| CollapsedGlyph | string? | null | Glyph shown on a collapsed group instead of the preset's plus or right-pointing triangle. |
| ExpandedGlyph | string? | null | Glyph shown on an expanded group instead of the preset's minus or down-pointing triangle. |
| ExpandIconStyle | string? | null | Inline CSS applied to the glyph span instead of the preset's style. |
| ExpandIconTemplate | RenderFragment<bool>? | null | Replaces the glyph span entirely; receives true when the group is expanded and must handle its own click. |
| GroupFooterTemplate | RenderFragment<object>? | null | Declared, but never read; group footers are built from AggregateRows. See Grouping & totals. |
| GroupFootersAlwaysVisible | bool | false | Declared, but never read. See Grouping & totals. |

### Header menu

| Name | Type | Default | Description |
|---|---|---|---|
| AllowColumnReorder | bool | true | Lets a header be dragged onto another header's drop zone to move the column. Drag-to-group is wired separately through the group strip. See Column reorder. |
| EnableHeaderContextMenu | bool | true | Opens the built-in menu on a header right-click; off, the event bubbles to the host unless ShowColumnMenu is on. |
| HeaderContextMenuShowsColumns | bool | false | Replaces the header menu's commands with a checked list of columns that toggles their visibility. |
| HeaderClickShowsColumns | bool | false | A left-click on a header opens that checked column list instead of sorting; needs the header menu or ShowColumnMenu. |
| OnHeaderAttachmentsRequested | EventCallback<string> |  | Adds an Attachments item to the header menu and fires with the column's field; without a handler the item is not rendered. |
| EnableCellContextMenu | bool | false | Opens a Cut, Copy, Paste and Delete menu on a data-cell right-click, except while a row or batch edit is active. Off, the right-click reaches OnContextMenu. |
| ColumnReorderPipeColor | string | "#2b2b2b" | CSS color of the vertical insertion pipe shown while a header is dragged; blank falls back to the default. |
| ColumnRenameMaxLength | int | 255 | Longest caption the header rename box accepts; 0 removes the page limit. A registered IGridColumnCaptionLimit can lower it, never raise it. |
| ShowColumnMenu | bool | false | Adds sort, filter, visibility, auto-fit and left/right locking commands to the header menu, and lets that menu open even when EnableHeaderContextMenu is off. |
| ShowColumnMenuButton | bool | false | Three-dot button on each header that opens the header menu; needs EnableHeaderContextMenu or ShowColumnMenu. |

### Print

| Name | Type | Default | Description |
|---|---|---|---|
| ShowPrintOptionsDialog | bool | true | The header menu's Print command opens the print-options dialog seeded from the defaults below; off, it exports a PDF with those defaults at once. See Export & templates. |
| DefaultPrintOrientation | GridPdfOrientation | GridPdfOrientation.Portrait | Page orientation the print options start from. See Export & templates. |
| DefaultPrintPageSize | GridPdfPageSize | GridPdfPageSize.Letter | Page size (Letter, Legal or A4) the print options start from. See Export & templates. |
| DefaultPrintColumnLayout | GridPdfColumnLayout | GridPdfColumnLayout.WrapText | How columns meet the page width: WrapText, ClipText or FitColumnsToPage. See Export & templates. |
| DefaultPrintGridLines | bool | true | Whether the printed table draws grid lines. See Export & templates. |
| DefaultPrintZoomMode | GridPdfZoomMode | GridPdfZoomMode.FitToPage | FitToPage or Percent; the latter uses DefaultPrintZoomPercent. See Export & templates. |
| DefaultPrintZoomPercent | int | 100 | Zoom for the Percent mode, clamped to 25 to 200. A change to any print default re-seeds the options unless the dialog is open. See Export & templates. |
| IncludeTotalsInExport | bool | true | Appends the AggregateRows marked ShowInFooter as total rows at the end of every export table. See Export & templates. |
| DelimitedExportEncoding | GridDelimitedTextEncoding | GridDelimitedTextEncoding.Utf8NoBom | Text encoding of CSV and TSV files; the other formats ignore it. See Export & templates. |
| ExportAllProviderItems | bool | false | With an ItemsProvider, exports page through the whole current query instead of the loaded window. See Export & templates. |
| ProviderExportPageSize | int | 1_000 | Rows requested per page during a complete provider export, clamped to 1 to 100000. See Export & templates. |
| ProviderExportProgressChanged | EventCallback<GridProviderExportProgress> |  | Raised after each received export page and once more on completion or cancellation. See Export & templates. |

### Column chooser

| Name | Type | Default | Description |
|---|---|---|---|
| AvailableColumns | IEnumerable<ChooseColumnDescriptor>? | null | Schema for the Choose Columns dialog and the column panel, so columns not currently rendered can be listed unchecked. With no GridColumn children and auto-generation off it also supplies transient columns. Null falls back to the rendered columns. See Dynamic columns. |
| DefaultColumns | IEnumerable<ChooseColumnDescriptor>? | null | Layout applied by the dialog's Restore Default Layout button: listed columns take its visibility and order, the others keep theirs. Null restores the snapshot taken when the dialog opened. |
| OnColumnsChosen | EventCallback<ChooseColumnsResult> |  | Fires on OK in the Choose Columns dialog with the chosen visibility and order; a subscribed host applies the layout itself and the grid only persists it. Unsubscribed, the grid applies it. |
| OnLayoutChanged | EventCallback<GridSettings> |  | Fires with a GridSettings snapshot after the user reorders, resizes, groups, hides or renames a column. |
| PersistenceKey | string? | null | Key under which an IGridSettingsStore registered in DI loads the saved layout once columns exist and saves it after each user change; empty, or no store, disables persistence. |
| ColumnChooserTemplate | RenderFragment<GridColumnChooserContext>? | null | Replaces the body of the Choose Columns dialog; receives a GridColumnChooserContext. |
| OnStateChanged | EventCallback<GridStateChangedEventArgs> |  | Fires with a detached GridState snapshot and the kind of change after user-driven state changes; suppressed while a state is being applied. |

### Chart

| Name | Type | Default | Description |
|---|---|---|---|
| ShowAsChart | bool | false | Renders each row as a mini bar chart through ChartControl instead of the table; needs ChartValueFields. Row windowing and column virtualization are off in this view. |
| ChartValueFields | IList<string>? | null | Properties whose numeric values become the bars of each row. |
| ChartLabelField | string? | null | Property used as each row's label; null uses the first visible column's field. |
| ChartValueLabels | IList<string>? | null | Axis labels for the value fields, passed to the chart. |
| ChartBarColor | string | "#2563eb" | Bar color passed to the chart. |
| ChartShowValues | bool | false | Prints each bar's value above it. |

### Settings

| Name | Type | Default | Description |
|---|---|---|---|
| FilterSettingsRef | FilterSettings? | null | Plain FilterSettings object read for the filter type, case sensitivity, search-as-you-type, the immediate-mode delay and the filter-row operators. |
| PageSettingsRef | PageSettings? | null | Plain PageSettings object whose PageSize, PageSizes and PageCount take precedence over the grid's own paging parameters. |
| EditSettingsRef | EditSettings? | null | Plain EditSettings object that turns editing on: mode, adding, deleting, confirmation and new-row position are all read from it. See Batch editing. |
| SelectionSettingsRef | SelectionSettings? | null | Plain SelectionSettings object read for the selection mode, the checkbox column and checkbox-only selection. |
| EventsRef | GridControlEvents<TValue>? | null | Plain GridControlEvents bundle; each grid event is raised through it when the matching callback has a delegate. |
| RowResizing | EventCallback<RowResizeEventArgs<TValue>> |  | Fires while a row is being resized, after the EventsRef counterpart; set Cancel to keep the old height or change NewHeight. |
| RowResized | EventCallback<RowResizeEventArgs<TValue>> |  | Fires when the resize ends, with the final height. |
| RowReordering | EventCallback<RowReorderEventArgs<TValue>> |  | Fires before a dragged row is moved; set Cancel to abandon the drop. |
| RowReordered | EventCallback<RowReorderEventArgs<TValue>> |  | Fires after the row has moved and been selected, with the resolved NewIndex. |

### Editing

| Name | Type | Default | Description |
|---|---|---|---|
| NewItemFactory | Func<TValue>? | null | Creates the item for a new row; null uses the parameterless constructor and throws when there is none. See Batch editing. |
| EnsureTrailingNewRow | bool | false | Keeps one blank new row at the end of an IList data source while EditSettings.AllowAdding is on. |
| IsTrailingNewRow | Func<TValue, bool>? | null | Tells the grid whether its tracked trailing row is still blank; null, or a predicate that throws, counts as blank. |
| BlankTrailingNewRowText | bool | false | Shows the tracked trailing row with empty cells while it is blank, whatever defaults the factory gave it; needs IsTrailingNewRow. |
| AddNewRowOnLastCellExit | bool | false | Moving forward from the last navigable cell appends a new row and starts editing its first editable cell; needs EditSettings.AllowAdding and an IList data source. |
| CanAddNewRowOnLastCellExit | Func<TValue, bool>? | null | Guard called with the current row before that append; returning false leaves focus at the grid edge. |
| CloneFactory | Func<TValue, TValue>? | null | Copies a row before editing; null creates a new item and copies the values across, entry by entry for dictionary-shaped rows and property by property otherwise. |
| ValidationSettings | GridValidationSettings<TValue>? | null | Opts row and batch editing into EditContext validation: data annotations, a custom validator and validation on each field change. Null performs no model validation. |

### Scrolling

| Name | Type | Default | Description |
|---|---|---|---|
| WindowOverscanRows | int | 60 | Rows rendered above and below the visible slice, and the ceiling for the cell budget. See 100k rows. |
| WindowOverscanCellBudget | int | 900 | Per-side overscan budget in cells: the effective row overscan is the budget divided by the visible column count, clamped between 15 (or WindowOverscanRows when lower) and WindowOverscanRows. 0 disables the budget. See 100k rows. |
| DeferredScrollOverscanRows | int | 20 | Rows buffered around the destination when a thumb release commits with ScrollTrack off; never below the refresh guard nor above the effective overscan. |
| ScrollTrack | bool | true | True tracks the vertical thumb live. False renders a browser-owned proxy thumb that previews locally and commits the destination window in one server render on release. |
| WheelScrollScale | double | 1d | Multiplier on vertical wheel and trackpad travel while the proxy thumb owns scrolling, clamped to 0.1 to 2. |
| EnableScrollBoundarySlowdown | bool | false | Slows wheel movement inside the prefetch zone near the rendered edge; only in force together with EnableScrollBoundaryGuard. |
| EnableAdaptiveWheelScrollPacing | bool | false | Learns a per-grid wheel rate from the browser's acknowledgment time; needs the guard and the slowdown. |
| EnableScrollBoundaryGuard | bool | false | Pauses wheel momentum on the last rendered row until the next window arrives, so a spacer is never shown; only while ScrollTrack is false. |
| EnableScrollBoundaryTelemetry | bool | false | Turns on browser-side wheel-window telemetry for the bench pages; only while ScrollTrack is false. |
| DiagnosticWindowScrollDelayMs | int | 0 | Bench-only delay, clamped to 0 to 5000 ms, added to each row-window callback of this grid. |
| MinimumRowsForWindowing | int | 0 | Collection data sources with this many rows or fewer skip row windowing; 0 windows every grid, and sources without a count keep windowing. |
| EnableGroupedRowWindowing | bool | true | Windows grouped grids over a flattened header, item and footer stream; off, a grouped grid renders every row. |
| PerformanceMode | GridPerformanceMode | GridPerformanceMode.ClientPreviewAndServerOptimized | ServerOptimized and ClientPreviewAndServerOptimized keep the server-side row lookup and render caches; ClientPreview and the combined mode move the cursor in the browser before the server render when ShowActiveCell is on. |

### Filtering

| Name | Type | Default | Description |
|---|---|---|---|
| FilterMode | GridFilterMode | GridFilterMode.None | Simple, SimpleWithMenu and Excel add a filter row under the header and count it in the ARIA row count; the grid reads no other value. |
| ShowMultiColumnSortingIndex | bool | false | Shows the sort priority badge next to the sort arrow when several columns are sorted. |

### Master detail

| Name | Type | Default | Description |
|---|---|---|---|
| DetailTemplate | RenderFragment<TValue>? | null | Renders a detail row under each expanded item and enables the expand column and the ExpandRow and CollapseRow API. Not allowed with a flat ItemsProvider. See Master-detail. |
| ExpandMode | GridExpandMode | GridExpandMode.Multiple | Single collapses the other rows when one expands; Multiple allows several and the expand-all button. See Master-detail. |
| ShowExpandColumn | bool | true | Shows the expand column when a DetailTemplate is set. See Master-detail. |
| ShowExpandAll | bool | false | Puts an expand-all/collapse-all button in the expand column's header; only in Multiple mode. See Master-detail. |
| RowExpand | EventCallback<TValue> |  | Fires with the item after it has been expanded. See Master-detail. |
| RowCollapse | EventCallback<TValue> |  | Fires with the item after it has been collapsed. See Master-detail. |

### Columns

| Name | Type | Default | Description |
|---|---|---|---|
| AutoGenerateColumns | bool | false | Builds the columns from the public readable properties of TValue and exposes them through Columns. See Dynamic columns. |
| ColumnHeaderBands | IReadOnlyList<GridColumnHeaderBand>? | null | One-level parent header bands over the listed fields; an entry here wins over a column's HeaderBand. Bands disable column virtualization. See Dynamic columns. |
| EnableColumnVirtualization | bool | false | Renders only the horizontally visible non-frozen columns plus the overscan; frozen columns stay mounted. Falls back to the full column set for pivot, chart, grouped, inline-editing, banded, templated, stacked and adaptive layouts. See Wide grids. |
| ColumnVirtualizationOverscan | int | 2 | Extra non-frozen columns kept on each side of the viewport. See Wide grids. |
| ColumnVirtualizationDefaultWidth | double | 0 | Pixel width assumed for columns with no pixel Width and no runtime resize; 0 makes such a column force the full render. See Wide grids. |
| ShowColumnVirtualizationFallback | bool | true | Shows a status line explaining why virtualization was requested but the grid fell back to the full render. See Wide grids. |

### Provider

| Name | Type | Default | Description |
|---|---|---|---|
| ItemsProvider | GridItemsProvider<TValue>? | null | Range provider that replaces DataSource; needs a bounded Height and, without provider grouping, fixed-height rows. Filtering, sorting and grouping become request descriptors. See On-demand loading. |
| ItemsProviderContextKey | object? | null | Opaque value sent with every request; a change starts a new query generation from the first row. |
| ItemKeySelector | Func<TValue, object?>? | null | Stable key for rendering, selection state and grid state when provider calls return new instances of the same row. See On-demand loading. |
| ItemsProviderCacheSize | int | 4 | Completed ranges kept per grid, clamped to 1 to 8. |
| EnableProviderFilterValueRequests | bool | false | Lets the Excel-style checklist ask the provider for distinct values with the FilterValues purpose; off, a partial checklist selection cannot be applied. See On-demand loading. |
| ProviderFilterValueRequestSize | int | 1_000 | Distinct values requested for one checklist, clamped to 1 to 100000. |
| EnableProviderGrouping | bool | false | Provider-executed lazy grouping when AllowGrouping and group descriptors are active; groups and their rows load on expansion. See On-demand loading. |
| ProviderGroupPageSize | int | 100 | Groups requested per lazy group page, clamped to 1 to 10000. See On-demand loading. |
| ProviderGroupItemPageSize | int | 250 | Leaf rows requested per lazy group page, clamped to 1 to 100000. See On-demand loading. |
| ProviderGroupsInitiallyCollapsed | bool | true | Newly received provider groups start collapsed; off, DefaultGroupsCollapsed decides. See On-demand loading. |

### Presentation

| Name | Type | Default | Description |
|---|---|---|---|
| GridLines | GridLines | GridLines.Both | Which cell borders the stylesheet draws: Both, Horizontal, Vertical or None; Default means Both. |
| Density | GridDensity | GridDensity.Default | Compact adds the fx-grid-density-compact class for tighter rows. |
| PagerPosition | GridPagerPosition | GridPagerPosition.Bottom | Where the pager renders while paging is active: bottom, top or both. |
| PagerTemplate | RenderFragment<GridPagerContext>? | null | Replaces the pager contents; receives a GridPagerContext with the page numbers and navigation callbacks. |
| RowTemplate | RenderFragment<GridRowTemplateContext<TValue>>? | null | Emits all data cells of a flat row itself, so built-in cell editing in that row is host-owned. Turns off row windowing and column virtualization, and is rejected with a flat ItemsProvider. |
| NoDataTemplate | RenderFragment? | null | Content of the empty row when the current view has no records. |
| DataLayoutMode | GridDataLayoutMode | GridDataLayoutMode.Columns | Stacked adds the stacked-layout class and turns off row windowing and column virtualization; rejected with a flat ItemsProvider. |
| AdaptiveMode | GridAdaptiveMode | GridAdaptiveMode.None | Auto adds the adaptive class; any value other than None turns off row windowing and column virtualization and is rejected with a flat ItemsProvider. |
| StackedColumnsCount | int | 1 | Sets the --fx-grid-stacked-columns variable for the stacked layout, clamped to 1 to 6. |
| AccessibleLabel | string | "Data grid" | The table's aria-label. |
| CustomKeyboardShortcuts | IReadOnlyDictionary<string, GridKeyboardCommand>? | null | Maps gestures such as Ctrl+Home or Alt+ArrowDown to a GridKeyboardCommand, matched case-insensitively before the built-in keys. |

### Aggregate row

| Name | Type | Default | Description |
|---|---|---|---|
| Columns | List<AggregateColumn> | new() | The aggregates in this row; each AggregateColumn yields one value per group and one for the grid footer. |
| ShowInGroupFooter | bool | true | Renders the row as a footer under each group's items; it is also counted in the grouped-window height math. |
| ShowInFooter | bool | false | Renders the row in the grid footer across all data, and includes it in exports while IncludeTotalsInExport is on. |
| ShowInGroupCaption | bool | false | Appends each value inline to the group header label, formatted with GroupCaptionTemplate. |
| ShowInGroupHeader | bool | false | Adds column-aligned cells to the group header row from the first aggregate column onward, formatted with GroupCaptionTemplate or else GroupFooterTemplate. |

### Aggregate column

| Name | Type | Default | Description |
|---|---|---|---|
| Field | string | "" | Property aggregated; with an ItemsProvider it is sent as a query aggregate. |
| Type | AggregateType | AggregateType.Sum | Sum, Average, Count, Min or Max; field and type together key the computed value. |
| Format | string? | null | .NET format string applied in the current culture when the value is IFormattable. |
| FooterTemplate | string | "{value}" | Text with a {value} placeholder used for the grid footer and as the fallback for the other templates; Grand Total, Sub Total and Total prefixes are stripped from the result. |
| GroupFooterTemplate | string? | null | Template for group footers and, failing a caption template, for header-row cells; null falls back to FooterTemplate. |
| GroupCaptionTemplate | string? | null | Template for the inline caption values and the header-row cells; null falls back to FooterTemplate for captions and to GroupFooterTemplate for header-row cells. |

## Examples

### Airports

```razor
@using Fx.ControlKit
@using Fx.ControlKit.Grid

<div class="airports">
    <GridControl TValue="Airport" DataSource="@_airports"
                 AllowSelection="true"
                 AllowSorting="true"
                 AllowFiltering="true"
                 AllowGrouping="true"
                 AllowResizing="true"
                 EnableHover="true"
                 ShowSearchBar="true"
                 GroupColumns="@_groupColumns"
                 AggregateRows="_aggregates"
                 Height="560px">
        <GridColumnsBase>
            <GridColumn Field="@nameof(Airport.Code)" HeaderText="Code" Width="80px"
                        IsFrozen="true" FrozenPosition="FrozenColumnPosition.Left">
                <Template Context="row">
                    <span class="code">@(((Airport)row).Code)</span>
                </Template>
            </GridColumn>
            <GridColumn Field="@nameof(Airport.Name)" HeaderText="Airport" Width="240px" />
            <GridColumn Field="@nameof(Airport.Country)" HeaderText="Country" Width="140px" />
            <GridColumn Field="@nameof(Airport.Type)" HeaderText="Type" Width="90px">
                <Template Context="row">
                    @{ var type = ((Airport)row).Type; }
                    <BadgeControl Text="@type" CssClass="@($"type type-{type.ToLowerInvariant()}")" />
                </Template>
            </GridColumn>
            <GridColumn Field="@nameof(Airport.ElevationFt)" HeaderText="Elevation (ft)" Width="110px"
                        Type="ColumnType.Number" Format="N0" TextAlign="TextAlign.Right" />
            <GridColumn Field="@nameof(Airport.LongestRunwayFt)" HeaderText="Longest runway (ft)" Width="150px"
                        Type="ColumnType.Number" Format="N0" TextAlign="TextAlign.Right" />
            <GridColumn Field="@nameof(Airport.Runways)" HeaderText="Runways" Width="90px"
                        Type="ColumnType.Number" TextAlign="TextAlign.Right" />
            <GridColumn Field="@nameof(Airport.City)" HeaderText="City" Width="130px" />
            <GridColumn Field="@nameof(Airport.Continent)" HeaderText="Continent" Width="120px" />
            <GridColumn Field="@nameof(Airport.Wikipedia)" HeaderText="Wikipedia" Width="90px" AllowSorting="false" AllowFiltering="false">
                <Template Context="row">
                    @{ var link = ((Airport)row).Wikipedia; }
                    @if (!string.IsNullOrEmpty(link))
                    {
                        <a href="@link" target="_blank" rel="noopener">Article</a>
                    }
                </Template>
            </GridColumn>
        </GridColumnsBase>
    </GridControl>
</div>
```

```csharp
// Airports: the OurAirports snapshot (Data/AirportData.cs), grouped by continent to start. Count needs a numeric field, so it
// counts Runways, which every airport has.
private readonly IReadOnlyList<Airport> _airports = AirportData.Airports;

private List<string> _groupColumns = new() { nameof(Airport.Continent) };

private List<AggregateRow> _aggregates = new()
{
    new AggregateRow
    {
        ShowInGroupCaption = true,
        Columns = new()
        {
            new AggregateColumn { Field = nameof(Airport.Runways), Type = AggregateType.Count,
                GroupCaptionTemplate = "{value} airports" },
            new AggregateColumn { Field = nameof(Airport.ElevationFt), Type = AggregateType.Average, Format = "N0",
                GroupCaptionTemplate = "avg elevation {value} ft" },
            new AggregateColumn { Field = nameof(Airport.LongestRunwayFt), Type = AggregateType.Max, Format = "N0",
                GroupCaptionTemplate = "longest runway {value} ft" },
        }
    }
};
```

