Skip to content

Drawer

The bq-drawer component is a slide-in side panel used for navigation menus, detail views, and supplementary content.

Basic Usage

html
<bq-button onclick="document.querySelector('#my-drawer').open = true">
  Open Drawer
</bq-button>

<bq-drawer id="my-drawer" title="Settings">
  <p>Drawer body content goes here.</p>
</bq-drawer>

Placement Variants

html
<bq-drawer title="Right (default)" placement="right">
  <p>Slides in from the right.</p>
</bq-drawer>

<bq-drawer title="Left" placement="left">
  <p>Slides in from the left.</p>
</bq-drawer>

<bq-drawer title="Top" placement="top">
  <p>Slides in from the top.</p>
</bq-drawer>

<bq-drawer title="Bottom" placement="bottom">
  <p>Slides in from the bottom.</p>
</bq-drawer>

Sizes

html
<bq-drawer title="Small Drawer" size="sm">
  <p>Narrow side panel.</p>
</bq-drawer>

<bq-drawer title="Medium Drawer" size="md">
  <p>Default width panel.</p>
</bq-drawer>

<bq-drawer title="Large Drawer" size="lg">
  <p>Wide panel for detailed content.</p>
</bq-drawer>

<bq-drawer title="Full Drawer" size="full">
  <p>Full-width panel.</p>
</bq-drawer>
html
<bq-drawer title="Edit Profile">
  <p>Update your profile information below.</p>
  <div slot="footer">
    <bq-button variant="ghost">Cancel</bq-button>
    <bq-button variant="primary">Save</bq-button>
  </div>
</bq-drawer>

Properties

PropertyTypeDefaultDescription
openbooleanfalseControls visibility of the drawer
titlestringDrawer heading text
placementright | left | top | bottomrightEdge from which the drawer slides in
sizesm | md | lg | fullmdWidth (or height for top/bottom) of the drawer

Events

EventDetailDescription
bq-closeFired when the drawer is dismissed

Slots

SlotDescription
(default)Drawer body content
footerFooter area, typically used for action buttons

CSS Parts

PartDescription
backdropBackground overlay behind the drawer
drawerThe drawer container
headerHeader section containing the title and close button
titleTitle text element
closeClose / dismiss button
bodyBody content area
footerFooter section

Accessibility

  • Uses role="dialog" and aria-modal="true" for proper screen reader semantics.
  • Title is linked via aria-labelledby so the drawer is announced by name.
  • Focus is trapped within the drawer while open and restored to the trigger on close.
  • Press Escape to dismiss the drawer.
  • Close button has a localized aria-label.

Released under the MIT License.