← All Components
<mth-error-boundary>
Captures subtree errors and mth-error events to render a localized declarative fallback.
When NOT to use: Do not use <mth-error-boundary> for expected inline field validation errors; use <mth-field> error messages.
Live Interactive Preview
Protected subtree healthy — click Simulate Error to test declarative fallback.
Ready · interact with <mth-error-boundary>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/primitives"></script>
<mth-error-boundary>Example</mth-error-boundary>import '@methane-ui/primitives';
import '@methane-ui/react';
export function Example() {
return <mth-error-boundary>Example</mth-error-boundary>;
}<script setup lang="ts">
import '@methane-ui/primitives';
</script>
<template>
<mth-error-boundary>Example</mth-error-boundary>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/primitives';
import { MthErrorBoundaryDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthErrorBoundaryDirective],
template: `<mth-error-boundary>Example</mth-error-boundary>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/primitives';
import MthErrorBoundary from '@methane-ui/svelte/MthErrorBoundary.svelte';
</script>
<MthErrorBoundary>Example</MthErrorBoundary>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
fallbackMessage | fallback-message | string | — | Optional fallback error message override. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-error-captured | { error: unknown } | Dispatched when a subtree error is captured. |
mth-reset | void | Dispatched when the error boundary resets. |
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". | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| i18n | Routes 2 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |