Drawer

data-side="right" slides in from the right edge

The parts are the same as a dialog's: <header>, <div> (scrolls) and <footer>. Open and close it like a dialog, with commandfor and command. A side drawer is the full height of the window and 24rem wide.

Filters

data-side="left" slides in from the left edge

data-side="bottom", or no data-side, slides up from the bottom edge

The default edge is the bottom, as in Tsugi. Top and bottom drawers are the full width of the window, at most 85% of its height, and keep their content in a centred 32rem column; their footer buttons fill that column, the main one first.

Delete 3 products?

They are removed from every category and campaign. This cannot be undone.

data-side="top" slides down from the top edge

Scheduled maintenance

Payments are paused on Sunday from 2:00 to 2:30 a.m.; orders placed then are captured afterwards.

close() takes a value, and the page reads it from the close event

A command="close" button with a value passes that value as returnValue, like calling drawer.close("csv") in JS. Read returnValue in the close event, then clear it: the browser keeps it for the next opening. Escape or a backdrop click leaves it empty. The slide-out runs before the dialog is gone; with reduced motion it closes at once.

Nothing chosen yet.

Export orders

Choose the file format.

API

Methods and properties (native)

Member Type Description
showModal() method Opens the drawer over the dimmed page; what command="show-modal" calls.
close(returnValue?) method Closes it with its slide-out; the optional string becomes returnValue.
returnValue property The value from close(value) or from the button's value. Empty after Escape; not reset on open.

Events (native)

Event Detail Description
close none Sent once the drawer has closed. Read returnValue here.
cancel none Before Escape or a backdrop click closes it. preventDefault() keeps it open.

Keyboard

Key Description
Esc Closes the drawer, with its slide-out.
Tab Moves between the controls of the drawer only.

No script: the slide uses CSS transitions, turned off by prefers-reduced-motion. A browser without discrete transitions shows and hides it at once.

Attributes

Attribute / element Values Description
class="drawer" on <dialog> The component.
data-side none or bottom (default), top, left, right The edge it slides in from. Left and right: full height, 24rem wide. Top and bottom: full width, up to 85% of the height.
aria-labelledby id of the <h2> Names the drawer. Required.
closedby any, closerequest (default), none any: Escape and a backdrop click close it. Same as the dialog.
commandfor + command drawer id + show-modal, close On a button: opens or closes the drawer.
value text, on a command="close" button Becomes the drawer's returnValue.
> header h2, p, close button The close button sits at the end of the first row.
> div any content Fills the height and scrolls.
> footer buttons Side drawers: at the end. Top and bottom drawers: stacked, full width.