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'-Grid mode - sets sensible defaults for common use cases
Basic Setup
 

Display Properties

PropertyTypeDefaultDescription
stripedbooleanfalseAlternating row background colors
hoverablebooleanfalseHighlight rows on hover
showRowNumbersbooleanfalseShow row number column on the left
classstring-Custom CSS class(es) on host element
stylestring-Inline styles on host element

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
pageablebooleanfalseEnable 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''auto'When 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
editablebooleanfalseEnable editing on all columns with editors
editTriggerEditTrigger'click'How editing is triggered: 'click', 'dblclick', 'button', 'always', 'navigate'
dropdownToggleVisibility'always' | 'on-focus''on-focus'When to show dropdown toggle button
openDropdownOnEnterbooleanfalseEnter opens dropdown (true) or moves down (false)
checkboxAlwaysEditablebooleanfalseMake checkboxes always interactive
invalidCellsCellValidationState[][]Currently invalid cells (for external tracking)

Row Toolbar Properties

PropertyTypeDefaultDescription
showRowToolbarbooleanfalseEnable row toolbar
rowToolbarRowToolbarConfig[][]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

Keyboard Shortcuts Properties

PropertyTypeDefaultDescription
rowShortcutsRowShortcut[][]Keyboard shortcuts for row operations (work on focused or hovered row)
showShortcutsHelpbooleanfalseShow 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
 

Labels/i18n Properties

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

Virtual Scroll Properties

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

Context Menu & Summary

PropertyTypeDefaultDescription
contextMenuContextMenuItem[]-Right-click menu items (supports shortcut property)
contextMenuXOffsetnumber8Horizontal offset from click position (pixels)
contextMenuYOffsetnumber0Vertical offset from click position (pixels)
summaryPositionstring-Position(s): "bottom-left", "top-right|bottom-right"
summaryContentCallbackfunction-Callback returning HTML content for summary
summaryInlinebooleantrueShare row with pagination

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
 

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 100+ CSS variables
  • Events vs Callbacks: Events use on* naming, callbacks use *Callback suffix