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

<mth-toast>

@methane-ui/ui~10.1 KB brotli (cold + Lit)~3.2 KB marginal

Non-intrusive notification toast and runtime NotificationStore viewport with pause-on-hover/focus, LiveAnnouncer integration, and logical placement.

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-toast> (@methane-ui/ui)
Show Live Toast
Ready · interact with <mth-toast>, or toggle Theme, Direction (LTR/RTL), or props above.

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/ui/toast"></script>
<mth-toast variant="info" duration="5000">Example</mth-toast>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
openopenbooleanfalseControls standalone toast visibility.
variantvariant'info' | 'success' | 'warning' | 'danger'"info"Semantic visual tone (info | success | warning | danger).
durationdurationnumber5000Auto-dismiss duration in milliseconds (0 disables auto-dismiss).
closableclosablebooleantrueShows a dismiss button when true.
placementplacement'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end'"bottom-end"Logical viewport corner or edge alignment.
headingheadingstring""Optional toast heading text.
messagemessagestring""Optional plain-text body overriding default slot fallback.
forceFallbackforce-fallbackbooleanfalseForces non-top-layer fallback mode.

Events

EventDetail TypeDescription
mth-openvoidCancelable event fired before showing the toast.
mth-after-openvoidFired once the entry animation completes.
mth-close{ reason: string }Cancelable event fired before dismissing the toast.
mth-after-close{ reason: string }Fired once the exit animation completes.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
Escapebothtoast is focused and closable is truedismisses toast notification

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
keyboardImplements all 1 APG keyboard transitions across LTR/RTL.mth-toast.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(open), :state(paused).Conformance suite
i18nRoutes 2 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test