Components

Drawer

A panel that slides in from the edge of the viewport.

A slide-in panel anchored to a viewport edge. Supports swipe-to-close on touch devices, focus trapping, and all four sides.

Anatomy

  • #trigger: Element that opens the drawer.
  • #handle: Optional drag handle. Usually shown at the top for bottom drawers.
  • #header: Region with title and close control.
  • #title: Drawer accessible title.
  • #description: Supplementary description text.
  • #body: Main content area.
  • #footer: Action buttons.

Usage

Examples

Bottom drawer

Use side="bottom" for mobile-style sheets and short task flows.

<template>
  <Drawer side="bottom" title="Options">
    <template #trigger="{ toggle }">
      <button @click="() => toggle()">Open options</button>
    </template>
    <template #body>
      <p>Sheet content.</p>
    </template>
  </Drawer>
</template>

Disable swipe to close

Disable swipe dismissal when accidental close would be costly.

<template>
  <Drawer :swipe-to-close="false" title="Required">
    <template #trigger="{ toggle }">
      <button @click="() => toggle()">Open</button>
    </template>
    <template #footer="{ close }">
      <button @click="() => close()">Done</button>
    </template>
  </Drawer>
</template>

Custom header

Use #header when the drawer needs custom title actions.

<template>
  <Drawer side="left">
    <template #trigger="{ toggle }">
      <button @click="() => toggle()">Menu</button>
    </template>

    <template #header="{ close, titleId }">
      <h2 :id="titleId">Navigation</h2>
      <button @click="() => close()"></button>
    </template>

    <template #body>
      <nav>...</nav>
    </template>
  </Drawer>
</template>

API Reference

Props

PropTypeDefaultDescription
side"left" | "right" | "top" | "bottom""right"Edge the drawer slides from.
titlestringConvenience title. Slot #title takes priority.
descriptionstringConvenience description. Slot #description takes priority.
ariaLabelstringFallback accessible name when no title is rendered.
insetnumber | string0Space between the drawer and the viewport edge.
closeOnBackdropClickbooleantrueClose when clicking the overlay.
swipeToClosebooleantrueAllow swiping the drawer closed on touch devices.
teleportstring | false"body"Teleport target.
asstring"div"Root element tag.
uiDrawerUiCSS class overrides.

Slots

SlotScoped propsDescription
trigger{ isOpen, open, close, toggle }Element that opens the drawer.
handleDrag handle element.
header{ close, titleId }Header region.
titleDrawer title. Defaults to the title prop.
descriptionDescription text. Defaults to the description prop.
body{ close, descriptionId }Main content area.
footer{ close }Action buttons region.

Exposed methods

MethodSignatureDescription
open(reason?, event?) => voidOpens the drawer.
close(reason?, event?) => voidCloses the drawer.
toggle(reason?, event?) => voidToggles the drawer.
titleIdstringAuto-generated id for the title element.
descriptionIdstringAuto-generated id for the description element.

Emits

EventPayloadDescription
open-change[open: boolean, details]Fired when the open state changes.

UI Options

KeyDescription
overlayThe backdrop overlay.
contentThe drawer panel.
headerThe header region.
titleThe title element.
descriptionThe description element.
bodyThe body region.
footerThe footer region.

Styling Hooks

UI keyCSS classData attrs
overlayakaza-drawer-overlaydata-akaza-state
contentakaza-drawerdata-akaza-state, data-akaza-side, data-swiping
headerakaza-drawer-header
titleakaza-drawer-title
descriptionakaza-drawer-description
bodyakaza-drawer-body
footerakaza-drawer-footer

Drawer renders trigger slot content plus teleported overlay/content. Use ui keys instead of relying on plain class fallthrough. The handle slot is fully owned by your markup.