Drawer

A panel sliding in from an edge: a RayDialog (focus, Escape, persistent, data-dialog-close, returnValue) with another look; modeless for side panels that keep the page interactive.

Source on GitHub

Patterns
CartFrom the right: items you can change, a running total, the checkout pinned to the footer.
Open
FiltersFrom the left with a blurred backdrop; Apply reports what was picked.
Open
Mobile navigationA floating panel (floating, size="xs") with links and the account at the bottom.
Open
Build logFrom the bottom (size="18rem"), with the status in the header.
Open
Inspectormodeless: no backdrop, the page stays usable; the button toggles it.
Toggle
Unsaved changesEscape and the backdrop are refused (ray-request-close) while the note is edited.
Open
Positions and sizes
start end top bottom xs md xl 40%
3 items
  • ray-elements sticker pack$29.00
  • Mechanical keycap set$48.00
  • raylang mug$12.00
Subtotal
$101.00
Shipping
Free
Total
$101.00
Keep shopping Check out
Category
Sort by
Reset Apply
Passed
12:00:01 build started on runner-3
12:00:02 resolving 14 dependencies
12:00:04 compiled 42 modules
12:00:04 warn unused import std/fs in src/sync.ray:3
12:00:05 tests: 128 passed, 0 failed
12:00:05 done in 4.1 s
tag
ray-card
padding
lg
radius
lg
with-border
true
size
320 × 184

No backdrop and no scroll lock: keep scrolling the page while it is open. Escape or × closes it.

No changes yet: Escape closes it.
Discard Save

position="end" · size="sm"

Code

API

For AI agents: this API as Markdown, or every component in llms-full.txt.

<ray-drawer> · RayDrawer

Any slotted element with data-dialog-close closes it. JS: show(), close(returnValue).

PropertyAttributeTypeDefaultDescription
openopen reflectsbooleanShown.
labellabelstringHeading (also the accessible name).
descriptiondescriptionstringA line under the title (the drawer's accessible description).
positionposition reflectsend | start | right | left | top | bottomendThe edge it slides from: start/end follow the writing direction; left/right are sides of the screen.
sizesize reflectsstringmdWidth (left/right) or height (top/bottom): xs…xl, full, content (as big as what it holds, up to the viewport: a bottom sheet) or any CSS length.
modelessmodeless reflectsbooleanNo backdrop nor scroll lock: the page stays interactive (a side panel).
floatingfloating reflectsbooleanDetached from the edge, with rounded corners.
persistentpersistent reflectsbooleanEscape and backdrop clicks do not close it.
hideClosehide-close reflectsbooleanNo close button in the header.
closeLabelclose-labelstringClose (text drawer.close)The close button's name, for screen readers.
overlayBluroverlay-blurstringBlur of the page behind: px ("8"), a CSS length or "none". Default: --ray-overlay-blur ([overlay] blur in tokens.toml).
EventDescription
ray-openAfter it opened.
ray-closeAfter it closed; detail: { returnValue }.
ray-request-closeEscape, backdrop or close button; cancelable.
SlotDescription
(default)Body (scrolls).
headerExtra header content.
footerActions, at the bottom.
PartDescription
drawerThe native <dialog>.
bodyThe body.

Texts

What it writes itself, in English; setStrings() translates them (Getting started: Languages).

KeyEnglish
drawer.closeClose