Pure CSS drawer built with .drawer + .drawer-wrapper structure. Toggled by adding /
removing the .drawer-open class.
.drawer (overlay) → .drawer-wrapper (card surface)..drawer-open and .drawer-close are mutually exclusive: add .drawer-open
to show, remove it and add .drawer-close to hide..drawer-backdrop is optional — without it the drawer clicks through.Available child nodes of .drawer:
.drawer-wrapper — content wrapper (card surface, required).drawer-backdrop — backdrop layer (optional; without it the drawer clicks through).drawer-tools — tools bar, absolutely positioned top-end (optional).drawer-header — header container (optional; auto-hidden when empty)
.drawer-title — title, child of header (optional, ellipsis truncation).drawer-body — scrollable main area (required)
.drawer-content — content container, child of body (inherits border radius).drawer-footer — bottom action area (optional)
.actions — action bar with start / center / end groups.btns.btns-flush — flush edge-to-edge button group.drawer-note — note text area at the bottom (optional)Complete structure with tools, title, body, footer and note.
4 positions are supported, the default is drawer-end.
Drawer sliding in from the end edge (default).
Drawer sliding in from the top edge.
Drawer sliding in from the bottom edge.
Drawer sliding in from the start edge.
drawer-* — any arbitrary width.drawer-scale-* — proportional sizes based on --default-width-input;
drawer-scale equals the default width of <input type="text">.drawer-full — full width (keeping safe side gaps).Width = 100 spacing units (100 * 4px).
Width = --default-width-input.
Width = 2 × --default-width-input.
Full horizontal width minus side gaps.
When the content fills the drawer, you may want to move the tools outside the wrapper.
.drawer-tools-outside places the tools bar outside / beside the wrapper.
.drawer-absolute confines the drawer inside a relative container. Close the drawer, then reopen it
from the button inside the box.
Drawer confined inside the relative container above.
drawer-media displays a single media item (image, video or iframe). The .drawer-body padding becomes 0 so the media fills the drawer.
.drawer-rounded applies the corner radius to the visible edge of the wrapper.
Rounded corners on the end-edge (left in LTR).
Rounded corners on the start-edge (right in LTR).
Rounded corners on the top edge (bottom corners).
Rounded corners on the bottom edge (top corners).
Full .actions bar with start / center / end groups inside .drawer-footer.
Full actions bar with start / center / end groups.
Use .btns.btns-flush inside .drawer-footer — the group fills the footer edge-to-edge (no
padding).
Footer using a flush button group.
.drawer-title, .drawer-header, .drawer-tools, .drawer-footer,
.drawer-backdrop and .drawer-note are all optional.
Drawer without .drawer-title — the empty header collapses.
Drawer without .drawer-header.
Drawer without .drawer-tools.
Drawer without .drawer-backdrop — surrounding content stays interactive.