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

<mth-cookie-banner>

@methane-ui/ui~7.9 KB brotli (cold + Lit)~2.0 KB marginal

Accessible cookie consent notice supporting one-click accept all, reject optional, and granular category preferences.

When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.

Live Interactive Preview

Multi-Framework Playground & Snippets

Properties & Attributes

PropertyAttributeTypeDefaultDescription
openopenbooleanfalseControls whether the cookie banner is visible.
positionposition'bottom' | 'top' | 'floating'"bottom"Placement mode (bottom, top, or floating).
headingheadingstring""Optional heading text overriding default localized title.
analyticsanalyticsbooleanfalseWhether optional analytics cookies are enabled.
marketingmarketingbooleanfalseWhether optional marketing cookies are enabled.
showPreferencesshow-preferencesbooleanfalseExpands the granular consent checkboxes.

Events

EventDetail TypeDescription
mth-openundefinedCancelable event fired before opening the banner.
mth-after-openundefinedFired after opening the banner.
mth-close{ reason: string }Cancelable event fired before closing the banner.
mth-after-closeundefinedFired after closing the banner.
mth-consent{ essential: boolean; analytics: boolean; marketing: boolean }Fired when consent preferences are confirmed.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
EscapebothopenDismisses the banner without accepting optional cookies.

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-cookie-banner.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(open), :state(preferences-open).Conformance suite
i18nRoutes 10 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test