Overview

The <web-grid> web component provides a high-performance data grid with editing, sorting, pagination, and Excel-like navigation.

Core Properties

PropertyTypeDefaultDescription
itemsT[][]Array of data objects to display
columnsColumn<T>[][]Column definitions (see Columns API)
mode'read-only' | 'excel' | 'input-matrix''excel'Grid mode - sets sensible defaults for common use cases
Basic Setup
 

Display Properties

PropertyTypeDefaultDescription
isStripedbooleantrueAlternating row background colors
isHoverablebooleantrueHighlight rows on hover
isRowNumbersVisiblebooleanfalseShow row number column on the left
isFilterablebooleanfalseShow filter inputs below column headers
classstring-Custom CSS class(es) on host element
stylestring-Inline styles on host element

Resizable Columns Properties

Excel-like column resizing by dragging header edges.

PropertyTypeDefaultDescription
gridNamestring-Unique name for localStorage persistence
shouldPersistColumnWidthsbooleanfalseSave column widths to localStorage
oncolumnresizefunction-Callback after column resize: (detail) => void

Column Properties

PropertyTypeDescription
isResizablebooleanPer-column opt-out (default: true)
minWidthstringMinimum width constraint (e.g., '50px')
maxWidthstringMaximum width constraint (e.g., '300px')

Methods

MethodDescription
setColumnWidth(field, width)Set width of a specific column
setColumnWidths(widths)Set widths of multiple columns
getColumnWidthsState()Get current widths of all columns
Column Resizing
 

Reorderable Columns Properties

Drag column headers to rearrange columns.

PropertyTypeDefaultDescription
isColumnReorderAllowedbooleanfalseEnable column drag-to-reorder
shouldPersistColumnOrderbooleanfalseSave column order to localStorage (requires gridName)
oncolumnreorderfunction-Callback after reorder: (detail) => void

Methods

MethodDescription
setColumnOrder(order)Set column order by field names array
getColumnOrderState()Get current column order
moveColumn(field, toIndex)Move a column to a specific index (internal - available on WebGrid, not directly on the web component element)
Column Reordering
 
Note: Frozen columns cannot be reordered. Drag threshold (5px) prevents accidental reorder when clicking to sort.

Fill Handle Properties

Excel-like drag-to-fill for copying values to adjacent cells.

PropertyTypeDefaultDescription
fillDirection'vertical' | 'all''vertical'Allowed fill directions (grid-level default)
fillDragCallbackfunction-Callback before fill: return false to cancel

Column Properties

PropertyTypeDescription
fillDirection'vertical' | 'all'Per-column override for fill direction
Fill Handle
 
Type-based validation: Fill handle automatically validates values by column type:
  • Number columns: Only numeric values accepted
  • Select/Combobox: Only values from options accepted
  • Date columns: Only valid dates accepted
  • Text/Autocomplete: Any value (use fillDragCallback for custom validation)

Freeze Panes Properties

Excel-like frozen columns that stay visible while scrolling horizontally.

PropertyTypeDefaultDescription
isStickyRowNumbersbooleanfalseMake row number column sticky (frozen)
freezeColumnsnumber0Number of columns to freeze from the left

Column Properties

PropertyTypeDescription
isFrozenbooleanMark column as frozen (moves to left automatically)
Freeze Panes
 

Sorting Properties

PropertyTypeDefaultDescription
sortMode'none' | 'single' | 'multi''none'Sorting mode: disabled, single column, or multi-column with Ctrl+Click
sortSortState[][]Current sort state (for initial/controlled sort)
Sort State
 

Pagination Properties

PropertyTypeDefaultDescription
isPageablebooleanfalseEnable pagination
pageSizenumber10Items per page
currentPagenumber1Current page (1-based)
totalItemsnumber-Total items (for server-side pagination)
pageSizesnumber[][10, 25, 50, 100]Available page size options
showPaginationboolean | 'auto'trueWhen to show: true=always, false=never, 'auto'=hide when 1 page
paginationPositionstring'bottom-center'Position(s): "bottom-center", "top-right|bottom-right"
paginationLayoutstring-Element order: "pageSize|previous|pageInfo|next"
paginationLabelsCallbackfunction-Callback to customize pagination text

Editing Properties

PropertyTypeDefaultDescription
isEditablebooleanfalseEnable editing on all columns with editors
editTriggerEditTrigger'dblclick'How editing is triggered: 'click', 'dblclick', 'button', 'always', 'navigate'
dropdownToggleVisibility'always' | 'on-focus''always'When to show dropdown toggle button
shouldOpenDropdownOnEnterbooleanfalseEnter opens dropdown (true) or moves down (false)
isCheckboxAlwaysEditablebooleanfalseMake checkboxes always interactive
invalidCellsCellValidationState[][]Currently invalid cells (for external/server-side validation)
editStartSelection'selectAll' | 'cursorAtStart' | 'cursorAtEnd' | 'mousePosition''mousePosition'Cursor position when entering edit mode
shouldShowDropdownOnFocusbooleantrueShow dropdown when cell receives focus
focusedRowIndexnumber | nullnullCurrently focused row index (read-only)
validationTooltipCallbackfunction-Grid-level callback returning HTML for validation error tooltips

Pagination Mode

PropertyTypeDefaultDescription
paginationMode'client' | 'server''client'Client-side pagination (grid paginates items) or server-side (you manage pages via ondatarequest)

Cell Selection Properties

PropertyTypeDefaultDescription
cellSelectionMode'disabled' | 'click' | 'shift''click'Cell selection behavior
shouldCopyWithHeadersbooleanfalseInclude column headers when copying to clipboard

Paste Properties

Configure how Ctrl+V paste operations work in editable grids.

PropertyTypeDefaultDescription
pasteMode'skip-non-editable' | 'all-columns' | 'editable-only''skip-non-editable'How to handle non-editable cells during paste: skip over them, paste to all columns, or only paste to editable columns
shouldValidateOnPastebooleantrueRun column validation (beforeCommitCallback) on pasted values
createRowCallback(pastedData, rowIndex) => T-Callback to create new rows when pasting beyond existing data. Receives the parsed paste data and target row index.

Row Toolbar Properties

PropertyTypeDefaultDescription
isRowToolbarVisiblebooleanfalseEnable row toolbar
rowToolbarRowToolbarConfig[]['add', 'delete', 'duplicate']Toolbar items: strings ('add', 'delete', etc.) or custom objects
toolbarTrigger'hover' | 'click' | 'button''hover'How to show toolbar
toolbarPosition'auto' | 'left' | 'right' | 'top' | 'inline''auto'Toolbar position. 'inline' renders as fixed column
toolbarVerticalAlign'top' | 'center' | 'bottom''bottom'Vertical alignment of toolbar rows
toolbarHorizontalAlign'start' | 'center' | 'end' | 'cursor''center'Horizontal alignment (for top position)
inlineActionsTitlestring''Column header for inline toolbar mode
toolbarFollowsCursorbooleanfalseToolbar tracks mouse cursor horizontally
cellToolbarfunction-Callback returning cell-specific toolbar items
toolbarColumnstring | number-Pin toolbar over a specific column
cellToolbarOffsetnumber | string0.2Horizontal offset for cell-specific toolbar
toolbarBtnMinWidthstring-Minimum width for toolbar buttons (e.g., '80px')

Keyboard Shortcuts Properties

PropertyTypeDefaultDescription
rowShortcutsRowShortcut[][]Keyboard shortcuts for row operations (work on focused or hovered row)
isShortcutsHelpVisiblebooleanfalseShow info icon with available shortcuts overlay
shortcutsHelpPosition'top-right' | 'top-left''top-right'Position of shortcuts help icon
shortcutsHelpContentCallback() => string-Custom HTML content for shortcuts overlay
Row Shortcuts
 

Row Selection Properties

Multi-row selection via row number cells with keyboard shortcuts for batch operations.

PropertyTypeDefaultDescription
selectedRowsnumber[][]Array of selected row indices (read-only, sorted ascending)
rangeShortcutsRangeShortcut[][]Keyboard shortcuts that operate on all selected rows

Selection Methods

MethodDescription
selectRow(index, mode)Select a row. Mode: 'replace' (default), 'toggle', or 'range'
selectRowRange(from, to)Select all rows in a range (inclusive)
clearSelection()Clear all selected rows
isRowSelected(index)Check if a specific row is selected
getSelectedRowsData()Get the data objects for all selected rows
Row Selection
 

Focus & Editing Methods

MethodDescription
focusCell(rowIndex, colIndex)Focus a specific cell
startEditing(rowIndex, colIndex)Start editing a specific cell
openCustomEditor(rowIndex, colIndex)Open custom editor for a cell

Draft Management Methods

MethodDescription
getRowDraft(rowIndex)Get the draft (edited) state of a row
hasRowDraft(rowIndex)Check if row has unsaved edits
discardRowDraft(rowIndex)Discard edits for a specific row
discardCellDraft(rowIndex, field)Discard edits for a specific cell (internal - available on WebGrid, not directly on the web component element)
getDraftRowIndices()Get indices of all rows with unsaved edits
discardAllDrafts()Discard all unsaved edits

Validation Methods

MethodDescription
isCellInvalid(rowIndex, field)Check if a cell has a validation error
getCellValidationError(rowIndex, field)Get the validation error message for a cell
canEditCell(rowIndex, field)Check if a cell is editable (not locked, column is editable). Second parameter is the field name string

Row Identification Methods

MethodDescription
getRowId(row)Get the ID of a row data object (uses idValueMember or idValueCallback)
findRowById(id)Find row index by ID
updateRowById(id, changes)Merge changes into a row identified by ID
replaceRowById(id, newRow)Replace entire row data by ID

Row Locking Methods

MethodDescription
isRowLocked(rowOrId)Check if a row is locked. Takes a row data object or row ID
getRowLockInfo(rowOrId)Get lock info for a row. Takes a row data object or row ID
lockRowById(id, lockInfo?)Lock a row externally (for WebSocket scenarios)
unlockRowById(id)Unlock an externally locked row
getExternalLocks()Get all external locks
clearExternalLocks()Clear all external locks

Cell Selection Methods

MethodDescription
selectCellRange(range)Select a range of cells. Takes a CellRange object with startRowIndex, startColIndex, endRowIndex, endColIndex
clearCellSelection()Clear cell selection
getSelectedCells()Get all selected cell coordinates
copyCellSelectionToClipboard()Copy selected cells to clipboard as TSV
copySelectedRowsToClipboard()Copy selected rows to clipboard

Labels/i18n Properties

PropertyTypeDescription
labelsPartial<GridLabels>Translatable UI strings (merged with defaults)
Labels Configuration
 

Virtual Scroll Properties

PropertyTypeDefaultDescription
isVirtualScrollEnabledbooleanfalseEnable virtual scrolling
virtualScrollThresholdnumber100Auto-enable when items >= threshold
virtualScrollRowHeightnumber38Fixed row height in pixels
virtualScrollBuffernumber10Extra rows above/below viewport
isInfiniteScrollEnabledbooleanfalseEnable infinite scroll (load more)
infiniteScrollThresholdnumber100Pixels from bottom to trigger load
hasMoreItemsbooleantrueSet to false when no more data

Scroll Properties

PropertyTypeDefaultDescription
isScrollablebooleanfalseConstrain grid to viewport height
scrollMaxHeightstring'100vh'Custom max-height for the grid container
tableBorderOnlybooleanfalseShow border only around the table, not the full container

Tooltip Properties

PropertyTypeDefaultDescription
tooltipShowDelaynumber400Delay in ms before showing tooltip
tooltipHideDelaynumber100Delay in ms before hiding tooltip

Context Menu & Summary

Row Context Menu

PropertyTypeDefaultDescription
contextMenuContextMenuItem[]-Right-click menu items for cells/rows (supports shortcut property)
contextMenuXOffsetnumber8Horizontal offset from click position (pixels)
contextMenuYOffsetnumber0Vertical offset from click position (pixels)

Header Context Menu

PropertyTypeDefaultDescription
headerContextMenuHeaderMenuConfig[]-Right-click menu items for column headers. Accepts predefined strings or custom items.
onheadercontextmenuopenfunction-Callback before header menu opens: (ctx: HeaderMenuContext) => void | false. Return false to prevent opening.
Header Context Menu
 

Summary

PropertyTypeDefaultDescription
summaryPositionstring-Position(s): "bottom-left", "top-right|bottom-right"
summaryContentCallbackfunction-Callback returning HTML content for summary
isSummaryInlinebooleantrueShare row with pagination
summaryMetadataunknown-Server-provided metadata passed to summaryContentCallback

New Empty Row Experimental

PropertyTypeDefaultDescription
isNewRowEnabledbooleanfalseShow an empty row for adding new data
newRowPosition'top' | 'bottom''bottom'Position of the new row
newRowIndicatorstring'+'Indicator shown in row number cell
createEmptyRowCallback() => T-Callback to create a new empty row object

Row Locking Properties

Lock rows to prevent editing (useful for collaborative scenarios).

PropertyTypeDescription
idValueMemberstringProperty name for row ID (e.g., 'id')
idValueCallback(row) => unknownCallback to compute row ID
rowLockingRowLockingOptionsRow locking configuration (see below)
Row Locking
 

Styling Callbacks

PropertyTypeDescription
customStylesCallback() => stringReturn custom CSS to inject into shadow DOM
rowClassCallback(row, rowIndex) => string | nullDynamic CSS class for rows
Styling Callbacks
 

Grid Modes

The mode property sets sensible defaults for common use cases:

read-only

Display-only grid. Editing disabled, optimized for viewing data.

excel

Excel-like behavior. Navigate mode with arrow keys, type to edit, Enter/Tab to commit.

input-matrix

Form-like behavior. All cells editable, Tab moves between cells.

Grid Mode
 

Callbacks

See Events API for full details. Key callbacks not listed in other sections:

CallbackDescription
onrowfocusFired when focused row changes (master/detail)
onrowlockchangeFired when a row's lock state changes
oncellselectionchangeFired when cell selection changes
onbeforepasteFired before paste operation - return false to cancel
onpasteFired after paste operation completes
idValueCallbackCallback to compute row ID (alternative to idValueMember)

TypeScript Support

The component is fully typed with generic support:

TypeScript Example
 

Global API

Access component functionality through window.keenmate.grid:

Method / PropertyReturnsDescription
version()stringReturns the component version
configobjectPackage metadata (name, version, author, etc.)
register()voidManually register the custom element
getInstances()HTMLElement[]Get all active grid instances on the page
Global API Usage
 

Important Notes

  • Generic Types: Component supports any data structure via T parameter
  • Reactive: All properties are reactive - changes update the UI automatically
  • Shadow DOM: Component uses Shadow DOM for style encapsulation
  • CSS Variables: Customize appearance with 170+ CSS variables
  • Events vs Callbacks: Events use on* naming, callbacks use *Callback suffix