Skip to content

Drawer

A panel that slides in from the side, often used for filters, details, and similar scenarios.

Basic usage

Right drawer

Open right drawer

Panel content sliding in from the right; click the mask, the close button, or press Esc to close.

Left drawer

Left drawer

Open left drawer

Status: All

Category: All

Sort: Created time

Disable mask close

no-mask-close prevents closing the drawer by clicking the mask (other close paths remain).

no-mask-close

Open drawer

Clicking the mask won't close it; use ✕ / Esc or the footer buttons.

Controlled visibility

visible is a controlled attribute: the host (button/JS) sets or removes it, and the component never restores it automatically; after closing, listen for oas-ok / oas-close and remove visible.

Controlled visibility (visible)

Open (set visible)Close (remove visible)

External buttons set / remove visible to control visibility without relying on the footer buttons.

No footer buttons

Open drawer without footer buttons

The footer action area is hidden; only ✕ and Esc remain as close entries.

Event feedback

Event feedback

Open and listen to events

Click "OK" or "Cancel" and watch the message at the top-right.

Custom width

Custom width

Open 640px drawer

Specify the drawer width via the width attribute, supporting px or percentages (e.g. 50%); on narrow screens it is constrained by max-width: 90vw.

Size presets

Size presets

small (256px)large (736px)

small tier: 256px, suited for auxiliary info on narrow screens.

large tier: 736px, suited for complex forms or detail scenarios.

API

Attributes

AttributeDescriptionTypeDefault
no-footerHide footer action buttonsboolean
no-mask-closeDisable closing on mask clickboolean
placementSlide directionstringright
sizePreset size or a concrete value: small (256px) / medium (378px) / large (736px), or write directly like 512px, 40%
titleTitle textstring
visibleWhether shownboolean
widthDrawer width (px or percentage), takes precedence over size

Events

EventDescription
oas-closeClose: cancel button / ✕ / mask click / Esc
oas-okClicked "OK"

Slots

NameDescription
default

role="dialog" + aria-modal="true"; focus moves to the close button on open and is restored on close.