Duolith docs

Drawer

A modal panel that slides in from the start edge over the screen, such as an app's sections, closed by Escape, the scrim, its Close button or a swipe toward the edge.

Stability: experimental

Props

PropTypeDefaultMeans
titlestringThe heading at the top of the panel, and the dialog's accessible name.
openbooleanbindable(false)Whether the drawer shows. Bind it with bind:open={name}; the trigger piece sets it.

Pieces

PieceMeans
triggerThe control that opens the drawer. Focus returns to it on close.

Children

The drawer's content, such as links to the app's sections.

States

StateLooks like
closedNothing but the trigger.
openA panel the drawer's width (at most 85% of the window) at the start edge, at full height, over the scrim.

Accessibility

roledialog with aria-modal="true"
nameThe title prop.
focusOn open, focus moves into the panel and Tab stays inside; on close it returns to the trigger.
keyboardEscape closes it; Enter and Space press Close.
notesA swipe left on the panel closes it. Right-to-left layouts are not mirrored yet: the panel stays on the left.

Theme tokens

color.scrim color.surface color.ink shadow.lg space.2 space.4 text.heading

Example

<Drawer title="Sections" bind:open={menu}><Link href="/" label="Home" /></Drawer>