Drawer

Material Design 3-styled drawer web component (lit-material-drawer) — a non-modal, persistent overlay panel, e.g. for a notification drawer.

  • 1.6 KB gzipped
  • @lit-material/drawer 0.0.3
  • Renders on the server

Example

Install

npm install @lit-material/drawer @lit-material/tokens
import "@lit-material/drawer";

Link @lit-material/tokens/css/index.css once per page for the colour, type and shape tokens. Install guide

API

<lit-material-drawer>

A non-modal, persistent overlay panel — for a notification drawer, an activity feed, or any contextual panel that should stay open alongside the page rather than blocking it. Built on the native Popover API (popover="manual", the same foundation lit-material-tooltip uses), not <dialog>: there's no scrim, no focus trap, and no Escape-to-close, because unlike lit-material-side-sheet's modal variant, this component doesn't demand the user deal with it before doing anything else. popover="manual" also means it never light-dismisses on an outside click the way an auto popover (lit-material-menu, lit-material-speed-dial) would — "persistent" is the point, so closing it is always an explicit action (a close button in header, or setting open = false yourself).

Properties

PropertyAttributeTypeDefaultDescription
openopenbooleanfalse
positionpositionDrawerPosition"end"Which viewport edge the drawer is anchored to.

Slots

SlotDescription
headerOptional header content — typically a title and a close button, as a single wrapping element.
defaultThe drawer's content.

CSS parts

PartDescription
headerThe header slot's container.
bodyThe main content's container.

Source on GitHub npm