// Generated by scripts/generate-showcase.mjs. Do not edit directly. page DrawerDetail { layout = "showcase" state playground_open = (ctx.url.searchParams.get("pg_open") ?? "false") === "true" state playground_defaultOpen = (ctx.url.searchParams.get("pg_defaultOpen") ?? "false") === "true" state playground_placement = ctx.url.searchParams.get("pg_placement") ?? "right" state playground_size = ctx.url.searchParams.get("pg_size") ?? "md" state playground_color = ctx.url.searchParams.get("pg_color") ?? "primary" state playground_variant = ctx.url.searchParams.get("pg_variant") ?? "default" state playground_title = ctx.url.searchParams.get("pg_title") ?? "Drawer playground" state playground_description = ctx.url.searchParams.get("pg_description") ?? "A polished default drawer for a modern application." state playground_icon = ctx.url.searchParams.get("pg_icon") ?? "" state playground_label = ctx.url.searchParams.get("pg_label") ?? "Drawer" state playground_closeLabel = ctx.url.searchParams.get("pg_closeLabel") ?? "Drawer" state playground_showClose = (ctx.url.searchParams.get("pg_showClose") ?? "true") === "true" state playground_closeOnBackdrop = (ctx.url.searchParams.get("pg_closeOnBackdrop") ?? "true") === "true" state playground_closeOnEscape = (ctx.url.searchParams.get("pg_closeOnEscape") ?? "true") === "true" state playground_duration = Number(ctx.url.searchParams.get("pg_duration") ?? "260") state playground_overlay = (ctx.url.searchParams.get("pg_overlay") ?? "true") === "true" state playground_scrollable = (ctx.url.searchParams.get("pg_scrollable") ?? "true") === "true" state playground_triggerLabel = ctx.url.searchParams.get("pg_triggerLabel") ?? "Open playground drawer" state playground_triggerIcon = ctx.url.searchParams.get("pg_triggerIcon") ?? "" state playground_class = ctx.url.searchParams.get("pg_class") ?? "showcase-instance showcase-instance--1" seo { title = "Drawer" description = "Present responsive modal side or bottom content with focus management, backdrop behavior, slots, and close events." } view {
Overlays component

Drawer

Present responsive modal side or bottom content with focus management, backdrop behavior, slots, and close events.

20 props4 slots3 outputsTheme readyResponsive
Interactive playground

Configure Drawer

Change any prop and inspect the server-rendered component immediately.

Live preview

Place forms, filters, navigation, or record details here.

Component code
<Drawer
  title="Drawer example"
  description="A polished default drawer for a modern application."
  closeLabel="Drawer"
  triggerLabel="Drawer">
  <div data-slot="trigger">
    <div class="showcase-slot">trigger slot</div>
  </div>
  <div data-slot="header">
    <div class="showcase-slot">header slot</div>
  </div>
  <div data-slot="footer">
    <div class="showcase-slot">footer slot</div>
  </div>
</Drawer>
Event outputInteract with the preview to inspect the typed payload.
Component props20 controls
Live examples

Designed for real product surfaces

Compare configurations and resize the browser to check responsive behavior.

Recommended

Right-side detail drawer

Keep supporting record details or forms available without leaving the page.

01
Live preview

Click the trigger to open the drawer

Place forms, filters, navigation, or record details here.

Component usage.wrn
<Drawer
  title="Citizen service details"
  description="Review supporting information without leaving the current page."
  icon="icon-[lucide--panel-right]"
  closeLabel="Drawer"
  triggerLabel="Open drawer"
  triggerIcon="icon-[lucide--panel-right-open]">
  <div data-slot="trigger">
    <div class="showcase-slot">trigger slot</div>
  </div>
  <div data-slot="header">
    <div class="showcase-slot">header slot</div>
  </div>
  <div class="showcase-overlay-content"><p>Place forms, filters, navigation, or record details here.</p></div>
  <div data-slot="footer">
    <button type="button" class="showcase-action showcase-action--primary">Save changes</button>
  </div>
</Drawer>
Compact

Bottom mobile drawer

Use a bottom sheet for compact mobile workflows and contextual actions.

02
Live preview

Click the trigger to open the drawer

Mobile-friendly supporting actions.

Component usage.wrn
<Drawer
  placement="bottom"
  size="sm"
  variant="soft"
  title="Choose an action"
  description="A compact configuration for dashboards and dense product surfaces."
  icon="icon-[lucide--arrow-right]"
  label="Compact example"
  closeLabel="Compact example"
  triggerLabel="Open mobile sheet">
  <div data-slot="trigger">
    <div class="showcase-slot">trigger slot</div>
  </div>
  <div data-slot="header">
    <div class="showcase-slot">header slot</div>
  </div>
  <div class="showcase-overlay-content"><p>Mobile-friendly supporting actions.</p></div>
  <div data-slot="footer">
    <div class="showcase-slot">footer slot</div>
  </div>
</Drawer>
Advanced

Wide navigation drawer

Open a wide, scrollable drawer with custom header and footer content from an explicit trigger.

03
Live preview

Click the trigger to open the drawer

Long scrollable content

Filters, navigation, details, and forms can be composed here.

Component usage.wrn
<Drawer
  placement="left"
  size="lg"
  variant="success"
  title="Navigation and filters"
  description="A wide drawer for complex supporting workflows."
  icon="icon-[lucide--trash-2]"
  label="Advanced example"
  closeLabel="Advanced example"
  triggerLabel="Open navigation drawer"
  triggerIcon="icon-[lucide--panel-left-open]">
  <div data-slot="trigger">
    <div class="showcase-slot">trigger slot</div>
  </div>
  <div data-slot="header">
    <div class="showcase-slot">header slot</div>
  </div>
  <div class="showcase-overlay-content showcase-overlay-content--tall"><p>Long scrollable content</p><p>Filters, navigation, details, and forms can be composed here.</p></div>
  <div data-slot="footer">
    <div class="showcase-slot">footer slot</div>
  </div>
</Drawer>
Component outputs

Receive every typed component output

Use declarative output handlers in .wrn files or register a direct output handler from JavaScript. The canonical API exposes payload and does not require event.detail.

@openFires after the component opens.
@closeFires after the component closes.
@cancelFires when the user cancels or dismisses the current workflow.
Declarative handlers.wrn
<Drawer
  @open='console.log(payload)'
  @close='console.log(payload)'
  @cancel='console.log(payload)'
/>
Direct output handlers.js
import { registerOutputHandler } from "@wrnexus/csr/outputs"

const component = document.querySelector("[data-ui-component=\"Drawer\"], [data-component=\"Drawer\"]")

if (component) registerOutputHandler(component, "open", (payload) => {
  console.log("open", payload)
})

if (component) registerOutputHandler(component, "close", (payload) => {
  console.log("close", payload)
})

if (component) registerOutputHandler(component, "cancel", (payload) => {
  console.log("cancel", payload)
})
Component API

Props and configuration

All content and behavior shown above is supplied through these props and slots.

PropTypeDefaultRequired
openbooleanfalseNo
defaultOpenbooleanfalseNo
placementstring"right"No
sizestring"md"No
colorstring"primary"No
variantstring"default"No
titlestring"Drawer"No
descriptionstring""No
iconstring""No
labelstring"Drawer"No
closeLabelstring"Close drawer"No
showClosebooleantrueNo
closeOnBackdropbooleantrueNo
closeOnEscapebooleantrueNo
durationnumber260No
overlaybooleantrueNo
scrollablebooleantrueNo
triggerLabelstring""No
triggerIconstring""No
classstring""No
} }