Drawer

An edge-anchored dialog that slides in from any side — settings panels, carts, mobile nav.

Import#

import { Drawer } from "astralis-ui";
// Same anatomy as Modal: Drawer.Trigger, .Content, .Header,
// .Body, .Footer, .Title, .Description, .Close, .CloseButton

Usage#

Drawer shares Modal's anatomy and behavior — focus trap, scroll lock, Escape/backdrop dismissal — but anchors to an edge and slides instead of fading in the center. If the content is a critical decision, use Modal; if it's a workspace panel, use Drawer.

Placements#

placement picks the edge. For left/right the size prop sets width (18–32rem, or full); for top/bottom it sets height (30–80vh, or full).

Props#

PropTypeDefaultDescription
open / defaultOpen / onOpenChangeboolean / boolean / (open) => void— / false / —Controlled / initial state and callback.
placement"left" | "right" | "top" | "bottom""right"Edge to slide from.
size"sm" | "md" | "lg" | "xl" | "full""md"Width (left/right) or height (top/bottom).
closeOnOverlayClickbooleantrueDismiss on backdrop click.
closeOnEscbooleantrueDismiss on Escape.

The parts (Trigger, Content, Header, Body, Footer, Title, Description, Close, CloseButton) behave exactly as documented on Modal.

Keyboard#

KeyAction
EscClose (opt out with closeOnEsc={false})
Tab / Shift+TabCycle focus inside the drawer — it can't escape

Focus returns to the trigger on close; with stacked overlays, Escape peels the topmost layer first.

Accessibility#

Identical to Modal: role="dialog" + aria-modal, portalled, focus-trapped, scroll-locked, with Title/Description wired to the dialog automatically.