← All Components
<mth-banner>
Full-width announcement and system notice banner supporting semantic variants, sticky positioning, inline actions, and cancelable dismissal.
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-banner>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/banner"></script>
<mth-banner variant="info">Example</mth-banner>import '@methane-ui/ui/banner';
import '@methane-ui/react';
export function Example() {
return <mth-banner variant="info">Example</mth-banner>;
}<script setup lang="ts">
import '@methane-ui/ui/banner';
</script>
<template>
<mth-banner variant="info">Example</mth-banner>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/banner';
import { MthBannerDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthBannerDirective],
template: `<mth-banner variant="info">Example</mth-banner>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/banner';
import MthBanner from '@methane-ui/svelte/MthBanner.svelte';
</script>
<MthBanner variant="info">Example</MthBanner>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
variant | variant | 'info' | 'success' | 'warning' | 'danger' | 'neutral' | "info" | Visual tone (info, success, warning, danger, or neutral). |
dismissible | dismissible | boolean | false | Renders a close button to dismiss the banner. |
dismissed | dismissed | boolean | false | Hides the banner when true. |
sticky | sticky | boolean | false | Pins the banner to the top edge via position: sticky. |
heading | heading | string | "" | Optional short summary heading. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-dismiss | undefined | Cancelable event fired before dismissing the banner. |
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(dismissed), :state(sticky). | Conformance suite |
| i18n | Routes 2 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |