A framework-agnostic data grid web component — sorting, filtering, pagination, inline editing (8 editor
types), cell range selection, Excel-compatible clipboard, row toolbar, context menus, frozen columns, column
reorder / resize, fill handle, tree mode, virtual scroll and full CSS-variable theming, all in one
Shadow DOM <web-grid> element built on @keenmate/web-components-core.
This repository is a workspaces monorepo with one published package:
| Package | What | Docs |
|---|---|---|
@keenmate/web-grid |
The <web-grid> element, its controller and TypeScript types |
README (install, quick start, browser support) · usage / API reference · theming · examples / cookbook · accessibility |
- CHANGELOG.md — release history.
- Release notes — upgrade guides per release (2.0.0-rc01).
- docs/ — internal design notes (action pipeline, z-index layers).
examples-*.html— the example pages (runnpm run dev).
Upgrade guide: the 2.0.0-rc01 release notes; full list: the CHANGELOG 2.0.0-rc01 section. A major release — breaking, with no aliases.
- Core — every option is an attribute and a validated input — 1.x observed no attributes, so
<web-grid is-striped>was dead markup.<web-grid>now extends@keenmate/web-components-core'sBlissElement: every scalar / enum option is one input row — an HTML attribute (enable-paging,page-size,striped,preset), a typed property (GridElementConfig) and a validated value. An invalid value warns, firesinput-rejectedand keeps the previous one; removing an attribute resets the default. The element gains core's lifecycle (defer/release(),ready/whenReady(),destroy()), responsive rules per device or breakpoint,customStyles(page-wide too) andreadonly/disabledwith native semantics. - Interaction model — one
ctx, DOM events, action items — every callback takes onectxcarryingcontrollerandelement(formatCallback(value, row)→getDisplayValueCallback(ctx)), every event is a DOM event with anon*twin (onrowchange→row-change/onRowChange), and the row toolbar, the cell / header menus and the shortcuts share core's action-item shape with oneactionevent. The built-ins (add,delete,duplicate,move-up,move-down) now do the work — veto them withbeforeActionCallback.el.gridis replaced by the frozenel.controller; the engine and the module plumbing are private. - Naming — suite-wide renames — properties follow the Keenmate naming rules (
isFilterable→isFilteringEnabled,isEditable→isEditingEnabled,mode→preset,freezeColumns→frozenColumnCount,*Visible→*Shown), enum values are kebab-case ('mouse-position',sortMode: 'multiple'), the tree API uses web-treeview's names (pathMember,expandLevel,expandedPaths: string[],row-expand/expanded-change) andidMember(default'id') is the one row-id member. The release notes carry every old → new table. - Keyboard and accessibility — an ARIA grid with one tab stop — the table is
role="grid"(treegridin tree mode) with row / column counts and indexes that stay right in a virtual grid,aria-selected,aria-readonlyandaria-sort. Like Excel, the grid is one tab stop in every edit mode: only the active cell hastabindex="0", Tab leaves the grid, Enter / F2 reach the controls inside a cell. Shift+Arrow builds cell ranges, Shift+F10 opens the cell menu, tooltips show on keyboard focus, and the cell dropdown is an ARIA combobox. - Editing and clipboard — the Excel rules — leaving a cell saves the edit (a click outside, another overlay,
startEditing()elsewhere), Escape cancels. Copy takes what the cell shows — option labels, formatted dates, locale numbers,getDisplayValueCallback— and a pasted option label maps back to its value. Ctrl+V and type-to-edit work in every edit mode, pasted text is typed per column, the number editor validates strictly, andrenderCellCallbackwins in every column type (null= the built-in look). - Localization — labels, locale, number formats — UI strings go through core
/locale: flat<elementType>.<name>keys (labels.pageInfo,menuItems.sortAsc), a page-wide dictionary inwindow.components.locale, and atranslateCallbackper grid or per page. The newlocaleinput formats number columns Excel-style (1.234,50inde) and parses typed text with the same separators;parseNumberCallbackreads text your own way. - Phone, touch and overlays — sheets and finger drags — on a phone the cell dropdown and the date editor are an edge-to-edge sheet and the menus a bottom sheet (
menu-presentation), with core's sheet chrome and the Back gesture. Column resize and reorder work with a finger. The menus run on core/menu, the dropdown and date editor on corecreatePopover()in the grid's shadow root, so they follow the grid's theme; the filter row matches case- and accent-insensitively. - Theming and icons — the shared contract — standalone colours follow
@keenmate/base-css-variables2.0 (derived steps from--wg-accent-color), motion chains to--base-duration-*, layers sit on the core--base-z-*tiers and the context menus theme through--wg-context-menu-*→--km-menu-*. Icons render through corerenderIcon(markup, built-in names, the grid's or the page'srenderIconCallback, icon-font classes) and repaint when the page hook changes; loaders draw core's shared loader (renderLoadingCallback).
- Excel-like commit-on-click-away — new
shouldCommitOnClickAwayproperty (defaults totrue). Clicking a different cell while editing now commits the in-progress value throughbeforeCommitCallback/validateCallbackinstead of silently discarding it. Set tofalseto keep the legacy discard behavior. Companion fix: row focus (.wg__row--focused) now applies on the first cell click — previously it only landed on the second. - CSS surface taxonomy aligned with pure-admin's
--base-*names —--wg-surface-1/2/3renamed to--wg-main-bg/--wg-elevated-bg,--wg-surface-floating→--wg-dropdown-bg(--wg-surface-3merged into--wg-hover-bg). Consumer overrides of the old names need to migrate; see the CHANGELOG mapping table. - Dark mode reworked to respect consumer themes — the dark-mode override blocks used to set
--wg-*to hardcoded literals, silently overriding pure-admin / theme-designer values. They now just flipcolor-schemeand letlight-dark()invariables.cssdo the work. The consumer's--base-*chain stays the source of truth. - OS-aware dark mode via
light-dark()fallbacks — every hardcoded fallback invariables.cssis wrapped inlight-dark(<light>, <dark>). A consumer who only setsbody { color-scheme: dark }(no overrides, no framework class) now gets a sensible dark palette automatically. - CSS architecture refactor:
@layercascade + canonical file set —main.cssnow declares@layer variables, component, overrides;so consumer rules beat library defaults without!important. CSS filenames dropped the underscore prefix (pure-CSS doesn't use SASS-partial convention). New canonical Tier-2 files (controls.css/floating.css/states.css/animations.css) match the cross-component pattern. --base-active-bg+--base-inverse-bg— two new cross-component theming hooks.--base-active-bgdistinguishes pressed from hover;--base-inverse-bgcovers tooltip and future inverse UI surfaces. Both are optional and additive.- Context menu was leaking through stale
--base-*names — was referencing--base-layer-01/--base-stroke-default/--base-error-color(all long-removed in pure-admin). Now uses the canonical names; consumers loading a pure-admin theme finally get themed context menus instead of silent fallbacks. - WCAG contrast e2e suite — 18 assertions check header / body / hover / focused / selected-row / editing-cell contrast against the 3:1 threshold (WCAG AA for non-text UI). Catches theme regressions invisible to visual smoke tests.
Earlier releases: CHANGELOG (no release notes before 2.0.0-rc01).
npm install @keenmate/web-grid<script type="module">
import '@keenmate/web-grid';
</script>
<web-grid id="grid" sort-mode="single" enable-paging page-size="25"></web-grid>
<script type="module">
const grid = document.getElementById('grid');
grid.columns = [
{ field: 'name', title: 'Name' },
{ field: 'age', title: 'Age', horizontalAlign: 'right' },
];
grid.items = [{ id: 1, name: 'Ada', age: 36 }, { id: 2, name: 'Linus', age: 54 }];
</script>Browser support, editor IntelliSense and the full walkthrough: the package README.
npm install
npm run dev # example pages (examples-*.html) on the devkit dev server
npm run build # builds packages/web-grid (+ custom-elements.json)
npm run build:examples # static examples site into dist-examples/
npm run test:unit # vitest (packages/web-grid)
npm run test:e2e # Playwright, against the fixture pages under test/
npm run doctor # kmwc doctor (the BlissFramework rulebook checks)Authored and maintained by Keenmate s.r.o..
The component ships standalone with sensible light/dark defaults;
when mounted inside Pure Admin — or any
host that publishes the --base-* taxonomy via
@keenmate/theme-designer — it adopts the host's colors,
typography, and sizing automatically. There is no runtime
dependency on Pure Admin; the integration is opt-in via CSS
variables.
Follows the BlissFramework component guidelines for structure, theming, color-scheme, and accessibility.
MIT — see LICENSE.