← All Components
<mth-alert>
Inline status and alert banner with semantic live-region roles, variant icons, and optional dismiss control.
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-alert>, or toggle Theme, Direction (LTR/RTL), or props above.
Live Variants & States Showcase
variant="info"OKLCH tokens adapt automatically.
variant="success"Package provenance verified.
variant="warning"Approaching workspace rate threshold.
variant="danger" closableMissing required token key.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/alert"></script>
<mth-alert variant="info" open>Example</mth-alert>import '@methane-ui/ui/alert';
import '@methane-ui/react';
export function Example() {
return <mth-alert variant="info" open>Example</mth-alert>;
}<script setup lang="ts">
import '@methane-ui/ui/alert';
</script>
<template>
<mth-alert variant="info" open>Example</mth-alert>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/alert';
import { MthAlertDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthAlertDirective],
template: `<mth-alert variant="info" open>Example</mth-alert>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/alert';
import MthAlert from '@methane-ui/svelte/MthAlert.svelte';
</script>
<MthAlert variant="info" open>Example</MthAlert>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
variant | variant | 'info' | 'success' | 'warning' | 'danger' | "info" | Semantic intent and live-region role (info | success -> status; warning | danger -> alert). |
title | title | string | "" | Optional heading text displayed above the alert message. |
closable | closable | boolean | false | Displays a dismiss button that emits a cancelable mth-close event. |
open | open | boolean | true | Controls whether the alert is visible. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-close | { reason: string } | Cancelable event fired when the alert is dismissed. |
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 |
| states | Exposes ElementInternals CustomStateSet flags: :state(open). | Conformance suite |
| i18n | Routes 5 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |