← All Components
<mth-table>
Accessible data table reconciling <mth-column> children, .columns/.rows properties, and async DataSource<T> via TableCore, SelectionController, DataController, SlotCollectionController, and RovingFocusController.
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-table>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/table"></script>
<mth-table selectable="none" row-key="id">Example</mth-table>import '@methane-ui/ui/table';
import '@methane-ui/react';
export function Example() {
return <mth-table selectable="none" row-key="id">Example</mth-table>;
}<script setup lang="ts">
import '@methane-ui/ui/table';
</script>
<template>
<mth-table selectable="none" row-key="id">Example</mth-table>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/table';
import { MthTableDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthTableDirective],
template: `<mth-table selectable="none" row-key="id">Example</mth-table>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/table';
import MthTable from '@methane-ui/svelte/MthTable.svelte';
</script>
<MthTable selectable="none" row-key="id">Example</MthTable>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
rows | — | ReadonlyArray<unknown> | — | Array of row data records. |
columns | — | ReadonlyArray<unknown> | null | null | Imperative column definitions. |
dataSource | — | unknown | null | null | Async DataSource backing table rows. |
selectable | selectable | 'none' | 'single' | 'multiple' | "none" | Row selection mode (none, single, or multiple). |
selectedIds | — | ReadonlyArray<string> | — | Array of currently selected row IDs. |
filter | filter | string | "" | Global text filter applied via TableCore or DataController. |
caption | caption | string | "" | Visible/accessible <caption> text. |
label | label | string | "" | Accessible aria-label when caption is omitted. |
rowKey | row-key | string | "id" | Property key used to derive unique row IDs. |
striped | striped | boolean | false | Alternates subtle striping across body rows. |
stickyHeader | sticky-header | boolean | false | Pins the table header during vertical scrolling. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-sort | { sorting: ReadonlyArray<unknown> } | Emitted when sorting rules change. |
mth-selection-change | { selectedIds: ReadonlyArray<string> } | Emitted when selected row IDs change. |
mth-row-click | { id: string; row: unknown } | Emitted when a data row is clicked. |
mth-data-state | { status: unknown; count: number } | Emitted when DataController transitions state. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| ArrowRight | ltr | Header control has focus | Moves focus to next header control |
| ArrowLeft | rtl | Header control has focus in RTL | Moves focus to next header control |
| Home | both | Header control has focus | Moves focus to first header control |
| End | both | Header control has focus | Moves focus to last header control |
| Enter | both | Sortable column header button has focus | Toggles column sort order and emits mth-sort |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | Focus ownership matches focusModel="none" with host role="table". | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| keyboard | Implements all 5 APG keyboard transitions across LTR/RTL. | mth-table.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(loading), :state(empty), :state(error), :state(striped). | Conformance suite |
| i18n | Routes 8 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |