Methane@methane-ui/*
CSS LayoutsComponentsSkillsTheme BuilderGitHub
← All Components

<mth-alert>

@methane-ui/ui~6.8 KB brotli (cold + Lit)~1.4 KB marginal

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

Interactive StageLive Custom Element · <mth-alert> (@methane-ui/ui)
Automatically adapts to light, dark, density, and forced-colors preferences.
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>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
variantvariant'info' | 'success' | 'warning' | 'danger'"info"Semantic intent and live-region role (info | success -> status; warning | danger -> alert).
titletitlestring""Optional heading text displayed above the alert message.
closableclosablebooleanfalseDisplays a dismiss button that emits a cancelable mth-close event.
openopenbooleantrueControls whether the alert is visible.

Events

EventDetail TypeDescription
mth-close{ reason: string }Cancelable event fired when the alert is dismissed.

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusFocus ownership matches focusModel="none".lint-plugin & spec-compiler
contrastRenders legible borders, focus outlines, and selection indicators under forced-colors: active.Playwright forced-colors matrix
statesExposes ElementInternals CustomStateSet flags: :state(open).Conformance suite
i18nRoutes 5 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test