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

<mth-drawer>

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

Top-layer sliding sheet overlay wrapping native <dialog> with logical edge placements, focus trapping, and exit/enter transitions.

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-drawer> (@methane-ui/ui)
Open Live <mth-drawer>

Slide-over drawer supporting start, end, top, and bottom logical placements.

Ready · interact with <mth-drawer>, or toggle Theme, Direction (LTR/RTL), or props above.

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/ui/drawer"></script>
<mth-drawer placement="end" size="sm">Example</mth-drawer>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
openopenbooleanfalseControls open visibility of the drawer.
placementplacement'end' | 'start' | 'top' | 'bottom'"end"Logical edge from which the drawer slides (end | start | top | bottom).
sizesize'sm' | 'md' | 'lg' | 'full'"md"Drawer dimension preset (sm | md | lg | full).
labellabelstring""Accessible drawer title rendered in the header.
dismissibledismissiblebooleantrueAllows dismissing via Escape key, backdrop click, and close button.
modalmodalbooleantrueOpens in top-layer modal mode with backdrop and focus trap when true.
forceFallbackforce-fallbackbooleanfalseForces non-top-layer fallback positioning even when native top-layer is supported.

Events

EventDetail TypeDescription
mth-openvoidCancelable event fired before opening the drawer.
mth-after-openvoidFired once the entry transition completes.
mth-close{ reason: string }Cancelable event fired before closing the drawer.
mth-after-close{ reason: string }Fired once exit transition completes and focus restores.
mth-cancel{ reason: string }Cancelable event fired when dismissed via Escape or backdrop click.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
Escapebothopen and dismissible is trueemits mth-cancel, dismisses drawer, and restores focus

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusFocus ownership matches focusModel="host".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-drawer.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(open), :state(modal).Conformance suite
i18nRoutes 1 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test