← All Components
<mth-comparison-table>
Accessible feature and plan comparison matrix with semantic <th scope="col"> and <th scope="row"> headers, boolean inclusion indicators, and sticky headers.
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-comparison-table>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/comparison-table"></script>
<mth-comparison-table></mth-comparison-table>import '@methane-ui/ui/comparison-table';
import '@methane-ui/react';
export function Example() {
return <mth-comparison-table></mth-comparison-table>;
}<script setup lang="ts">
import '@methane-ui/ui/comparison-table';
</script>
<template>
<mth-comparison-table></mth-comparison-table>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/comparison-table';
import { MthComparisonTableDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthComparisonTableDirective],
template: `<mth-comparison-table></mth-comparison-table>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/comparison-table';
import MthComparisonTable from '@methane-ui/svelte/MthComparisonTable.svelte';
</script>
<MthComparisonTable></MthComparisonTable>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
caption | caption | string | "" | Visible <caption> text describing the comparison matrix. |
label | label | string | "" | Accessible region and table label when no visible caption is set. |
plans | — | unknown[] | — | Array of plan columns ({ id, name, price?, badge?, highlighted?, actionLabel? }). |
rows | — | unknown[] | — | Array of feature rows ({ id?, feature, description?, values }). |
stickyHeader | sticky-header | boolean | false | Pins column headers at the block start while scrolling. |
compact | compact | boolean | false | Applies denser vertical cell padding. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-select-plan | { id: string; name: string } | Emitted when a plan header action button is activated. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| ArrowLeft / ArrowRight | both | Horizontal scroll wrapper is focused | Scrolls overflowing comparison matrix horizontally |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | delegatesFocus: true with zero host internals.role (ADR-014). | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| keyboard | Implements all 1 APG keyboard transitions across LTR/RTL. | mth-comparison-table.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(sticky-header), :state(compact). | Conformance suite |
| i18n | Routes 5 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |