← All Components
<mth-pivot-table>
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
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>import '@methane-ui/datagrid/pivot-table';
import '@methane-ui/react';
export function Example() {
return <mth-pivot-table aggregator="sum" show-totals></mth-pivot-table>;
}<script setup lang="ts">
import '@methane-ui/datagrid/pivot-table';
</script>
<template>
<mth-pivot-table aggregator="sum" show-totals></mth-pivot-table>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/datagrid/pivot-table';
import { MthPivotTableDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthPivotTableDirective],
template: `<mth-pivot-table aggregator="sum" show-totals></mth-pivot-table>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/datagrid/pivot-table';
import MthPivotTable from '@methane-ui/svelte/MthPivotTable.svelte';
</script>
<MthPivotTable aggregator="sum" show-totals></MthPivotTable>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
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. |
aggregator | aggregator | 'sum' | 'count' | 'avg' | 'min' | 'max' | "sum" | Aggregation function applied to value fields. |
showTotals | show-totals | boolean | true | Whether to display the grand totals row. |
label | label | string | "" | Accessible pivot grid label. |
Events
| Event | Detail Type | Description |
|---|---|---|
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
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| ArrowDown | both | pivot row focused | moves roving focus to next row |
| ArrowUp | both | pivot row focused | moves roving focus to previous row |
| Enter | both | group toggle focused | toggles group expansion |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | Focus ownership matches focusModel="host". | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| keyboard | Implements all 3 APG keyboard transitions across LTR/RTL. | mth-pivot-table.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(empty), :state(grouped). | Conformance suite |
| i18n | Routes 7 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |