← All Components
<mth-spreadsheet>
Virtualized spreadsheet satellite with clean-room MIT Formula AST evaluator, A1/R1C1 addressing, cycle detection, keyboard navigation, and TSV clipboard support.
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-spreadsheet>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/spreadsheet/spreadsheet"></script>
<mth-spreadsheet rows="20" cols="8"></mth-spreadsheet>import '@methane-ui/spreadsheet/spreadsheet';
import '@methane-ui/react';
export function Example() {
return <mth-spreadsheet rows="20" cols="8"></mth-spreadsheet>;
}<script setup lang="ts">
import '@methane-ui/spreadsheet/spreadsheet';
</script>
<template>
<mth-spreadsheet rows="20" cols="8"></mth-spreadsheet>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/spreadsheet/spreadsheet';
import { MthSpreadsheetDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthSpreadsheetDirective],
template: `<mth-spreadsheet rows="20" cols="8"></mth-spreadsheet>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/spreadsheet/spreadsheet';
import MthSpreadsheet from '@methane-ui/svelte/MthSpreadsheet.svelte';
</script>
<MthSpreadsheet rows="20" cols="8"></MthSpreadsheet>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
rows | rows | number | 20 | Total number of worksheet rows. |
cols | cols | number | 8 | Total number of worksheet columns. |
cells | — | Readonly<Record<string, string>> | — | Map of A1 cell addresses to raw scalar or formula strings. |
addressMode | address-mode | 'A1' | 'R1C1' | "A1" | Cell reference display mode (A1 or R1C1). |
activeCell | active-cell | string | "A1" | Currently focused A1 cell address. |
rowHeight | row-height | number | 32 | Estimated row height in pixels. |
readonly | readonly | boolean | false | Prevents cell editing. |
label | label | string | "" | Accessible worksheet label. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-cell-select | { address: string; displayAddress: string; raw: string; value: unknown } | Fired when the active cell selection moves. |
mth-cell-change | { address: string; raw: string; value: unknown } | Fired when a cell value or formula is committed. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| ArrowDown | both | cell focused | moves active cell one row down |
| ArrowUp | both | cell focused | moves active cell one row up |
| ArrowRight | both | cell focused | moves active cell inline-end (direction-aware) |
| ArrowLeft | both | cell focused | moves active cell inline-start (direction-aware) |
| Enter | both | cell focused | opens inline formula/value editor or commits edit |
| Escape | both | editing cell | cancels edit without committing |
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 6 APG keyboard transitions across LTR/RTL. | mth-spreadsheet.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(readonly), :state(editing). | Conformance suite |
| i18n | Routes 6 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |