Methane@methane-ui/*
CSS LayoutsComponentsSkillsTheme BuilderGitHub
← All Components

<mth-datagrid>

@methane-ui/datagrid~12.3 KB brotli shell + lazy engine~4.4 KB shell · lazy engine chunk

Enterprise virtualized data grid wrapping @tanstack/table-core and @tanstack/virtual-core with sorting, filtering, pinning, column resizing, selection, and DataSource<T> streaming.

When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.

Live Interactive Preview

Interactive StageLive Custom Element · <mth-datagrid> (@methane-ui/datagrid)
Ready · interact with <mth-datagrid>, or toggle Theme, Direction (LTR/RTL), or props above.

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/datagrid/datagrid"></script>
<mth-datagrid row-height="40"></mth-datagrid>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
rows—ReadonlyArray<Record<string, unknown>>—Array of row records displayed in the grid.
columns—ReadonlyArray<unknown>—Column definitions with optional accessorKey, sortable, width, and pinned.
dataSource—unknown | null—Optional async DataSource<T, string> controller source.
selectableselectablebooleanfalseEnables multi-row checkbox selection.
multiSortmulti-sortbooleanfalseAllows sorting across multiple columns simultaneously.
filterfilterstring""Global search filter string applied across filterable columns.
rowHeightrow-heightnumber40Estimated virtual row block size in pixels.
labellabelstring""Accessible grid label.

Events

EventDetail TypeDescription
mth-sort-change{ sorting: ReadonlyArray<{ id: string; desc: boolean }> }Fired when column sorting updates.
mth-selection-change{ selectedIds: ReadonlyArray<string> }Fired when selected row IDs change.
mth-column-resize{ columnId: string; width: number }Fired when a column width is updated.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
ArrowDownbothgrid row focusedmoves roving focus to next row
ArrowUpbothgrid row focusedmoves roving focus to previous row
Homebothgrid row focusedmoves roving focus to first row
Endbothgrid row focusedmoves roving focus to last row
Enterbothcolumn sort header focusedtoggles sort order for column

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusFocus ownership matches focusModel="host".lint-plugin & spec-compiler
contrastRenders legible borders, focus outlines, and selection indicators under forced-colors: active.Playwright forced-colors matrix
keyboardImplements all 5 APG keyboard transitions across LTR/RTL.mth-datagrid.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(loading), :state(empty), :state(error), :state(selectable).Conformance suite
i18nRoutes 8 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test