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

<mth-pivot-table>

@methane-ui/datagrid~10.1 KB brotli shell + lazy engine~3.2 KB shell · lazy engine chunk

Multi-dimensional pivot table satellite wrapping @tanstack/table-core with row/column dimension grouping, aggregations (sum, count, avg, min, max), expandable groups, and grand totals.

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-pivot-table> (@methane-ui/datagrid)
Ready · interact with <mth-pivot-table>, or toggle Theme, Direction (LTR/RTL), or props above.

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/datagrid/pivot-table"></script>
<mth-pivot-table aggregator="sum" show-totals></mth-pivot-table>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
rows—ReadonlyArray<Record<string, unknown>>—Source records to aggregate.
rowDimensions—ReadonlyArray<string>—Field keys used for row grouping.
columnDimensions—ReadonlyArray<string>—Field keys used for pivot column buckets.
valueFields—ReadonlyArray<string>—Numeric field keys to aggregate.
aggregatoraggregator'sum' | 'count' | 'avg' | 'min' | 'max'"sum"Aggregation function applied to value fields.
showTotalsshow-totalsbooleantrueWhether to display the grand totals row.
labellabelstring""Accessible pivot grid label.

Events

EventDetail TypeDescription
mth-pivot-change{ aggregator: string; groupCount: number }Fired when pivot computation or aggregator updates.
mth-group-toggle{ groupKey: string; expanded: boolean }Fired when a pivot row group is expanded or collapsed.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
ArrowDownbothpivot row focusedmoves roving focus to next row
ArrowUpbothpivot row focusedmoves roving focus to previous row
Enterbothgroup toggle focusedtoggles group expansion

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 3 APG keyboard transitions across LTR/RTL.mth-pivot-table.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(empty), :state(grouped).Conformance suite
i18nRoutes 7 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test