> ## Documentation Index
> Fetch the complete documentation index at: https://www.beeq.design/llms.txt
> Use this file to discover all available pages before exploring further.

# Drawer

> Drawers are off-canvas panels that slide in from a screen edge to show secondary content, navigation, or actions without leaving the current page.

![BEEQ Drawer component overview](https://mintcdn.com/beeq/sS_4c30oR3xlqpA7/components/images/drawer/drawer-overview-light.svg?fit=max\&auto=format\&n=sS_4c30oR3xlqpA7\&q=85\&s=f3204d6d14e656b475c7e9764913c90a)

Drawer component overview

`bq-drawer` is a side panel that slides in from the edge of the screen to surface navigation menus, settings, notifications, or contextual actions. Users keep the underlying page in view, so they can complete focused tasks without losing context.

> [!NOTE]
>
> The drawer manages its own open/close animation and backdrop. Call the `show()` and `hide()` methods programmatically, or toggle the `open` prop, to control visibility. Do not remove the element from the DOM to hide it — use `hide()` instead.

## When to use

> [card]
>
> Use drawer when
>
> * You need to surface supplementary content — navigation menus, settings, notifications, or contextual actions — without navigating away from the current page
> * Users need a convenient way to access additional information or functionality while maintaining a clean and organised layout
> * The content is too complex or lengthy for a tooltip, popover, or dropdown

> [card]
>
> Do not use drawer when
>
> * Its presence would add unnecessary complexity or confusion — for simple applications where all necessary information can be displayed directly on the main screen
> * It would obscure essential content or functionality
> * There are better alternatives available for presenting supplementary information or navigation options, such as a dedicated page or `bq-dialog`

> [!TIP]
>
> Choose [`bq-dialog`](https://www.beeq.design/components/dialog) instead of `bq-drawer` when the user must respond before continuing, such as a blocking confirmation, and [`bq-tooltip`](https://www.beeq.design/components/tooltip) when the content is a short, non-essential hint.

## Patterns

> [card] With footer
>
> Use a footer to keep secondary actions — such as confirm, cancel, or links — anchored at the bottom of the panel. This separates actions from the main content and keeps them visible while users scroll.

> [card] Without footer
>
> Use a drawer without a footer when the panel only displays content or primary actions inline. This keeps the layout focused and avoids reserving space for actions you don't need.

## Anatomy

![BEEQ Drawer component anatomy](https://mintcdn.com/beeq/sS_4c30oR3xlqpA7/components/images/drawer/drawer-anatomy-light.svg?fit=max\&auto=format\&n=sS_4c30oR3xlqpA7\&q=85\&s=6623ab0dbb58d17fcc24dac3563acc48)

Drawer component anatomy

The drawer panel contains a header with an optional icon and headline, a scrollable content area (container/slot), an optional footer divider, and optional footer actions.

| Part | Element | Description |
| - | - | - |
| **1** | Headline | The title text displayed in the drawer header |
| **2** | Icon (optional) | An optional icon displayed alongside the headline in the header |
| **3** | Close icon button | The icon button that dismisses the drawer |
| **4** | Container / Slot | The main content area that holds the default slot; supports rich media, forms, icons, buttons, and more |
| **5** | Divider | The horizontal rule between the body and footer (shown when a footer is present) |
| **6** | Actions (optional) | Footer action buttons; typically one primary button and one secondary button |

## Design guidelines

### Position

Always position the drawer close to the relevant content to avoid confusing users and ensure intuitive navigation.

**1. end (default)**

The panel slides in from the end (right in LTR layouts). Use this for filter panels, detail views, and secondary settings — placing them on the right keeps them adjacent to the content being acted on.

**2. start**

The panel slides in from the start (left in LTR layouts). Use this for primary navigation menus that users expect on the left side.

### Container

The drawer container area can hold rich media, images, forms, icons, buttons, and more. Its internal layout can be adjusted for the use case — use flexbox or grid inside the default slot to control how content is arranged.

### Backdrop

The backdrop dims the page content behind the drawer, reinforcing that the drawer is in focus.

> [!NOTE]
>
> Enable the backdrop (`enable-backdrop`) when the drawer contains a form or detail view that should feel visually separate from the page. For lightweight navigation drawers that share the screen with the page, omit the backdrop to keep the experience lighter.

### Width

The default drawer width is `320px`, controlled by `--bq-drawer--width`. Increase it for content-heavy panels such as filter forms or data tables, but keep it narrow enough that the underlying page remains recognisably visible.

### Footer

Add a footer to house actions that apply to all content in the panel (e.g. save a form or close the panel). Buttons are left-aligned, and only one primary button should be used at a time. The footer slot is only rendered when it contains content.

### Keep it simple and clear

While drawers can efficiently store additional information not included on the parent page, you should not overwhelm users with excessive content. Organise and group information within the drawer to keep it clear and usable.

## Usage

> [!TIP]
>
> When using the Drawer component, you should place it high in the DOM hierarchy, for example as a direct child of `<body>` and not inside a container element. This ensures the drawer's fixed positioning and z-index work correctly across all layouts.

### Default

The default state of the drawer component displays a standard drawer with a header, content area, and footer. It typically slides in from the end (right) edge of the screen. Use this for general purposes when you need a drawer to provide additional content or options without disrupting the main view.

```css styles.css icon="css" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
.drawer-title {
  display: flex;
  align-items: center;
  gap: var(--bq-spacing-xs);
}

.drawer-description {
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: center;
  border-radius: var(--bq-radius--xs);
  border: 1px dashed var(--bq-stroke--brand);
  background-color: var(--bq-red-100);
}

.drawer-footer {
  display: flex;
  justify-content: center;
  gap: var(--bq-spacing-xs);
  flex: 1;
}
```

```javascript JavaScript icon="js" theme={"theme":{"light":"one-light","dark":"night-owl"}}
const btn = document.querySelector('bq-button');
const drawer = document.querySelector('bq-drawer');
btn.addEventListener('bqClick', () => drawer.show());
```

```html HTML icon="html5" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
<bq-button>Open Drawer</bq-button>

<bq-drawer position="end">
  <div class="drawer-title" slot="title">
    <bq-icon name="user-circle" weight="bold"></bq-icon>
    Title
  </div>
  <div class="drawer-description">Content</div>
  <div class="drawer-footer" slot="footer">
    <bq-button appearance="primary" block size="small">Button</bq-button>
    <bq-button appearance="link" block size="small">Button</bq-button>
  </div>
</bq-drawer>
```

```jsx React icon="react" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
import { useRef } from "react";
import { BqButton, BqDrawer, BqIcon } from "@beeq/react";
import "./styles.css";

export default function App() {
  const drawerRef = useRef(null);

  return (
    <>
      <BqButton onBqClick={() => drawerRef.current?.show()}>Open Drawer</BqButton>

      <BqDrawer ref={drawerRef} position="end">
        <div className="drawer-title" slot="title">
          <BqIcon name="user-circle" weight="bold" />
          Title
        </div>
        <div className="drawer-description">Content</div>
        <div className="drawer-footer" slot="footer">
          <BqButton appearance="primary" block size="small">Button</BqButton>
          <BqButton appearance="link" block size="small">Button</BqButton>
        </div>
      </BqDrawer>
    </>
  );
}
```

```ts Angular icon="angular" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
import { Component } from "@angular/core";
import { BqButton, BqDrawer, BqIcon } from "@beeq/angular/standalone";

@Component({
  selector: "app-root",
  standalone: true,
  imports: [BqButton, BqDrawer, BqIcon],
  template: `
    <bq-button (bqClick)="drawer.show()">Open Drawer</bq-button>

    <bq-drawer #drawer position="end">
      <div class="drawer-title" slot="title">
        <bq-icon name="user-circle" weight="bold"></bq-icon>
        Title
      </div>
      <div class="drawer-description">Content</div>
      <div class="drawer-footer" slot="footer">
        <bq-button appearance="primary" block size="small">Button</bq-button>
        <bq-button appearance="link" block size="small">Button</bq-button>
      </div>
    </bq-drawer>
  `,
  styles: [`
        .drawer-title {
          display: flex;
          align-items: center;
          gap: var(--bq-spacing-xs);
        }

        .drawer-description {
          display: flex;
          height: 100%;
          align-items: center;
          justify-content: center;
          border-radius: var(--bq-radius--xs);
          border: 1px dashed var(--bq-stroke--brand);
          background-color: var(--bq-red-100);
        }

        .drawer-footer {
          display: flex;
          justify-content: center;
          gap: var(--bq-spacing-xs);
          flex: 1;
        }
  `],
})
export class AppComponent {}
```

```vue Vue icon="vuejs" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
<script setup lang="ts">
import { ref } from "vue";
import { BqButton, BqDrawer, BqIcon } from "@beeq/vue";

const drawerRef = ref(null);
</script>

<template>
  <BqButton @bqClick="drawerRef?.show()">Open Drawer</BqButton>

  <BqDrawer ref="drawerRef" position="end">
    <div class="drawer-title" slot="title">
      <BqIcon name="user-circle" weight="bold" />
      Title
    </div>
    <div class="drawer-description">Content</div>
    <div class="drawer-footer" slot="footer">
      <BqButton appearance="primary" block size="small">Button</BqButton>
      <BqButton appearance="link" block size="small">Button</BqButton>
    </div>
  </BqDrawer>
</template>

<style>
  .drawer-title {
    display: flex;
    align-items: center;
    gap: var(--bq-spacing-xs);
  }

  .drawer-description {
    display: flex;
    height: 100%;
    align-items: center;
    justify-content: center;
    border-radius: var(--bq-radius--xs);
    border: 1px dashed var(--bq-stroke--brand);
    background-color: var(--bq-red-100);
  }

  .drawer-footer {
    display: flex;
    justify-content: center;
    gap: var(--bq-spacing-xs);
    flex: 1;
  }
</style>
```

### No footer

The no-footer variant removes the footer section, providing a cleaner interface without additional controls at the bottom. Use this when the drawer's primary purpose is to display content or options that do not require secondary actions.

```css styles.css icon="css" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
.drawer-title {
  display: flex;
  align-items: center;
  gap: var(--bq-spacing-xs);
}

.drawer-description {
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: center;
  border-radius: var(--bq-radius--xs);
  border: 1px dashed var(--bq-stroke--brand);
  background-color: var(--bq-red-100);
}
```

```javascript JavaScript icon="js" theme={"theme":{"light":"one-light","dark":"night-owl"}}
const btn = document.querySelector('bq-button');
const drawer = document.querySelector('bq-drawer');
btn.addEventListener('bqClick', () => drawer.show());
```

```html HTML icon="html5" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
<bq-button>Open Drawer</bq-button>

<bq-drawer position="end">
  <div class="drawer-title" slot="title">
    <bq-icon name="user-circle" weight="bold"></bq-icon>
    Title
  </div>
  <div class="drawer-description">Content</div>
</bq-drawer>
```

```jsx React icon="react" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
import { useRef } from "react";
import { BqButton, BqDrawer, BqIcon } from "@beeq/react";
import "./styles.css";

export default function App() {
  const drawerRef = useRef(null);

  return (
    <>
      <BqButton onBqClick={() => drawerRef.current?.show()}>Open Drawer</BqButton>

      <BqDrawer ref={drawerRef} position="end">
        <div className="drawer-title" slot="title">
          <BqIcon name="user-circle" weight="bold" />
          Title
        </div>
        <div className="drawer-description">Content</div>
      </BqDrawer>
    </>
  );
}
```

```ts Angular icon="angular" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
import { Component } from "@angular/core";
import { BqButton, BqDrawer, BqIcon } from "@beeq/angular/standalone";

@Component({
  selector: "app-root",
  standalone: true,
  imports: [BqButton, BqDrawer, BqIcon],
  template: `
    <bq-button (bqClick)="drawer.show()">Open Drawer</bq-button>

    <bq-drawer #drawer position="end">
      <div class="drawer-title" slot="title">
        <bq-icon name="user-circle" weight="bold"></bq-icon>
        Title
      </div>
      <div class="drawer-description">Content</div>
    </bq-drawer>
  `,
  styles: [`
        .drawer-title {
          display: flex;
          align-items: center;
          gap: var(--bq-spacing-xs);
        }

        .drawer-description {
          display: flex;
          height: 100%;
          align-items: center;
          justify-content: center;
          border-radius: var(--bq-radius--xs);
          border: 1px dashed var(--bq-stroke--brand);
          background-color: var(--bq-red-100);
        }
  `],
})
export class AppComponent {}
```

```vue Vue icon="vuejs" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
<script setup lang="ts">
import { ref } from "vue";
import { BqButton, BqDrawer, BqIcon } from "@beeq/vue";

const drawerRef = ref(null);
</script>

<template>
  <BqButton @bqClick="drawerRef?.show()">Open Drawer</BqButton>

  <BqDrawer ref="drawerRef" position="end">
    <div class="drawer-title" slot="title">
      <BqIcon name="user-circle" weight="bold" />
      Title
    </div>
    <div class="drawer-description">Content</div>
  </BqDrawer>
</template>

<style>
  .drawer-title {
    display: flex;
    align-items: center;
    gap: var(--bq-spacing-xs);
  }

  .drawer-description {
    display: flex;
    height: 100%;
    align-items: center;
    justify-content: center;
    border-radius: var(--bq-radius--xs);
    border: 1px dashed var(--bq-stroke--brand);
    background-color: var(--bq-red-100);
  }
</style>
```

### Start position

The `position` prop allows you to specify the edge from which the drawer appears. Use `position="start"` to open from the left edge — ideal for primary navigation menus.

```css styles.css icon="css" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
.drawer-title {
  display: flex;
  align-items: center;
  gap: var(--bq-spacing-xs);
}

.drawer-description {
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: center;
  border-radius: var(--bq-radius--xs);
  border: 1px dashed var(--bq-stroke--brand);
  background-color: var(--bq-red-100);
}

.drawer-footer {
  display: flex;
  justify-content: center;
  gap: var(--bq-spacing-xs);
  flex: 1;
}
```

```javascript JavaScript icon="js" theme={"theme":{"light":"one-light","dark":"night-owl"}}
const btn = document.querySelector('bq-button');
const drawer = document.querySelector('bq-drawer');
btn.addEventListener('bqClick', () => drawer.show());
```

```html HTML icon="html5" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
<bq-button>Open Drawer</bq-button>

<bq-drawer position="start">
  <div class="drawer-title" slot="title">
    <bq-icon name="user-circle" weight="bold"></bq-icon>
    Title
  </div>
  <div class="drawer-description">Content</div>
  <div class="drawer-footer" slot="footer">
    <bq-button appearance="primary" block size="small">Button</bq-button>
    <bq-button appearance="link" block size="small">Button</bq-button>
  </div>
</bq-drawer>
```

```jsx React icon="react" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
import { useRef } from "react";
import { BqButton, BqDrawer, BqIcon } from "@beeq/react";
import "./styles.css";

export default function App() {
  const drawerRef = useRef(null);

  return (
    <>
      <BqButton onBqClick={() => drawerRef.current?.show()}>Open Drawer</BqButton>

      <BqDrawer ref={drawerRef} position="start">
        <div className="drawer-title" slot="title">
          <BqIcon name="user-circle" weight="bold" />
          Title
        </div>
        <div className="drawer-description">Content</div>
        <div className="drawer-footer" slot="footer">
          <BqButton appearance="primary" block size="small">Button</BqButton>
          <BqButton appearance="link" block size="small">Button</BqButton>
        </div>
      </BqDrawer>
    </>
  );
}
```

```ts Angular icon="angular" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
import { Component } from "@angular/core";
import { BqButton, BqDrawer, BqIcon } from "@beeq/angular/standalone";

@Component({
  selector: "app-root",
  standalone: true,
  imports: [BqButton, BqDrawer, BqIcon],
  template: `
    <bq-button (bqClick)="drawer.show()">Open Drawer</bq-button>

    <bq-drawer #drawer position="start">
      <div class="drawer-title" slot="title">
        <bq-icon name="user-circle" weight="bold"></bq-icon>
        Title
      </div>
      <div class="drawer-description">Content</div>
      <div class="drawer-footer" slot="footer">
        <bq-button appearance="primary" block size="small">Button</bq-button>
        <bq-button appearance="link" block size="small">Button</bq-button>
      </div>
    </bq-drawer>
  `,
  styles: [`
    .drawer-title {
      display: flex;
      align-items: center;
      gap: var(--bq-spacing-xs);
    }

    .drawer-description {
      display: flex;
      height: 100%;
      align-items: center;
      justify-content: center;
      border-radius: var(--bq-radius--xs);
      border: 1px dashed var(--bq-stroke--brand);
      background-color: var(--bq-red-100);
    }

    .drawer-footer {
      display: flex;
      justify-content: center;
      gap: var(--bq-spacing-xs);
      flex: 1;
    }
  `],
})
export class AppComponent {}
```

```vue Vue icon="vuejs" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
<script setup lang="ts">
import { ref } from "vue";
import { BqButton, BqDrawer, BqIcon } from "@beeq/vue";

const drawerRef = ref(null);
</script>

<template>
  <BqButton @bqClick="drawerRef?.show()">Open Drawer</BqButton>

  <BqDrawer ref="drawerRef" position="start">
    <div class="drawer-title" slot="title">
      <BqIcon name="user-circle" weight="bold" />
      Title
    </div>
    <div class="drawer-description">Content</div>
    <div class="drawer-footer" slot="footer">
      <BqButton appearance="primary" block size="small">Button</BqButton>
      <BqButton appearance="link" block size="small">Button</BqButton>
    </div>
  </BqDrawer>
</template>

<style>
  .drawer-title {
    display: flex;
    align-items: center;
    gap: var(--bq-spacing-xs);
  }

  .drawer-description {
    display: flex;
    height: 100%;
    align-items: center;
    justify-content: center;
    border-radius: var(--bq-radius--xs);
    border: 1px dashed var(--bq-stroke--brand);
    background-color: var(--bq-red-100);
  }

  .drawer-footer {
    display: flex;
    justify-content: center;
    gap: var(--bq-spacing-xs);
    flex: 1;
  }
</style>
```

## Options

**Allowed `position` values:** `start`, `end` (default). Any other value logs a warning and falls back to `start`.

**Allowed `placement` values (deprecated):** `left`, `right` (default). Any other value logs a warning and falls back to `right`. Use `position` instead.

### With backdrop

The backdrop variant adds a semi-transparent overlay behind the drawer, helping to focus user attention on the drawer content while dimming the background. Enable this variant when you want to visually separate the drawer from the rest of the interface and provide a modal-like experience.

```css styles.css icon="css" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
.drawer-title {
  display: flex;
  align-items: center;
  gap: var(--bq-spacing-xs);
}

.drawer-description {
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: center;
  border-radius: var(--bq-radius--xs);
  border: 1px dashed var(--bq-stroke--brand);
  background-color: var(--bq-red-100);
}

.drawer-footer {
  display: flex;
  justify-content: center;
  gap: var(--bq-spacing-xs);
  flex: 1;
}
```

```javascript JavaScript icon="js" theme={"theme":{"light":"one-light","dark":"night-owl"}}
const btn = document.querySelector('bq-button');
const drawer = document.querySelector('bq-drawer');
btn.addEventListener('bqClick', () => drawer.show());
```

```html HTML icon="html5" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
<bq-button>Open Drawer</bq-button>

<bq-drawer position="end" enable-backdrop>
  <div class="drawer-title" slot="title">
    <bq-icon name="user-circle" weight="bold"></bq-icon>
    Title
  </div>
  <div class="drawer-description">Content</div>
  <div class="drawer-footer" slot="footer">
    <bq-button appearance="primary" block size="small">Button</bq-button>
    <bq-button appearance="link" block size="small">Button</bq-button>
  </div>
</bq-drawer>
```

```jsx React icon="react" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
import { useRef } from "react";
import { BqButton, BqDrawer, BqIcon } from "@beeq/react";
import "./styles.css";

export default function App() {
  const drawerRef = useRef(null);

  return (
    <>
      <BqButton onBqClick={() => drawerRef.current?.show()}>Open Drawer</BqButton>

      <BqDrawer ref={drawerRef} position="end" enableBackdrop>
        <div className="drawer-title" slot="title">
          <BqIcon name="user-circle" weight="bold" />
          Title
        </div>
        <div className="drawer-description">Content</div>
        <div className="drawer-footer" slot="footer">
          <BqButton appearance="primary" block size="small">Button</BqButton>
          <BqButton appearance="link" block size="small">Button</BqButton>
        </div>
      </BqDrawer>
    </>
  );
}
```

```ts Angular icon="angular" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
import { Component } from "@angular/core";
import { BqButton, BqDrawer, BqIcon } from "@beeq/angular/standalone";

@Component({
  selector: "app-root",
  standalone: true,
  imports: [BqButton, BqDrawer, BqIcon],
  template: `
    <bq-button (bqClick)="drawer.show()">Open Drawer</bq-button>

    <bq-drawer #drawer position="end" enable-backdrop>
      <div class="drawer-title" slot="title">
        <bq-icon name="user-circle" weight="bold"></bq-icon>
        Title
      </div>
      <div class="drawer-description">Content</div>
      <div class="drawer-footer" slot="footer">
        <bq-button appearance="primary" block size="small">Button</bq-button>
        <bq-button appearance="link" block size="small">Button</bq-button>
      </div>
    </bq-drawer>
  `,
  styles: [`
    .drawer-title {
      display: flex;
      align-items: center;
      gap: var(--bq-spacing-xs);
    }

    .drawer-description {
      display: flex;
      height: 100%;
      align-items: center;
      justify-content: center;
      border-radius: var(--bq-radius--xs);
      border: 1px dashed var(--bq-stroke--brand);
      background-color: var(--bq-red-100);
    }

    .drawer-footer {
      display: flex;
      justify-content: center;
      gap: var(--bq-spacing-xs);
      flex: 1;
    }
  `],
})
export class AppComponent {}
```

```vue Vue icon="vuejs" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
<script setup lang="ts">
import { ref } from "vue";
import { BqButton, BqDrawer, BqIcon } from "@beeq/vue";

const drawerRef = ref(null);
</script>

<template>
  <BqButton @bqClick="drawerRef?.show()">Open Drawer</BqButton>

  <BqDrawer ref="drawerRef" position="end" enableBackdrop>
    <div class="drawer-title" slot="title">
      <BqIcon name="user-circle" weight="bold" />
      Title
    </div>
    <div class="drawer-description">Content</div>
    <div class="drawer-footer" slot="footer">
      <BqButton appearance="primary" block size="small">Button</BqButton>
      <BqButton appearance="link" block size="small">Button</BqButton>
    </div>
  </BqDrawer>
</template>

<style>
  .drawer-title {
    display: flex;
    align-items: center;
    gap: var(--bq-spacing-xs);
  }

  .drawer-description {
    display: flex;
    height: 100%;
    align-items: center;
    justify-content: center;
    border-radius: var(--bq-radius--xs);
    border: 1px dashed var(--bq-stroke--brand);
    background-color: var(--bq-red-100);
  }

  .drawer-footer {
    display: flex;
    justify-content: center;
    gap: var(--bq-spacing-xs);
    flex: 1;
  }
</style>
```

### Custom footer divider

Replace the default footer divider by slotting a custom element into `slot="footer-divider"`. The example below uses `bq-divider` with a custom stroke.

```css styles.css icon="css" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
.drawer-title {
  display: flex;
  align-items: center;
  gap: var(--bq-spacing-xs);
}

.drawer-description {
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: center;
  border-radius: var(--bq-radius--xs);
  border: 1px dashed var(--bq-stroke--brand);
  background-color: var(--bq-red-100);
}

.drawer-footer-divider {
  display: block;
  margin-bottom: var(--bq-spacing-m);
}

.drawer-footer {
  display: flex;
  justify-content: center;
  gap: var(--bq-spacing-xs);
  flex: 1;
}
```

```javascript JavaScript icon="js" theme={"theme":{"light":"one-light","dark":"night-owl"}}
const btn = document.querySelector('bq-button');
const drawer = document.querySelector('bq-drawer');
btn.addEventListener('bqClick', () => drawer.show());
```

```html HTML icon="html5" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
<bq-button>Open Drawer</bq-button>

<bq-drawer position="end" enable-backdrop>
  <div class="drawer-title" slot="title">
    <bq-icon name="user-circle" weight="bold"></bq-icon>
    Title
  </div>
  <div class="drawer-description">Content</div>
  <bq-divider class="drawer-footer-divider" slot="footer-divider" stroke-color="stroke--primary" stroke-thickness="1"></bq-divider>
  <div class="drawer-footer" slot="footer">
    <bq-button appearance="primary" block size="small">Button</bq-button>
    <bq-button appearance="link" block size="small">Button</bq-button>
  </div>
</bq-drawer>
```

```jsx React icon="react" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
import { useRef } from "react";
import { BqButton, BqDivider, BqDrawer, BqIcon } from "@beeq/react";
import "./styles.css";

export default function App() {
  const drawerRef = useRef(null);

  return (
    <>
      <BqButton onBqClick={() => drawerRef.current?.show()}>Open Drawer</BqButton>

      <BqDrawer ref={drawerRef} position="end" enableBackdrop>
        <div className="drawer-title" slot="title">
          <BqIcon name="user-circle" weight="bold" />
          Title
        </div>
        <div className="drawer-description">Content</div>
        <BqDivider className="drawer-footer-divider" slot="footer-divider" strokeColor="stroke--primary" strokeThickness={1} />
        <div className="drawer-footer" slot="footer">
          <BqButton appearance="primary" block size="small">Button</BqButton>
          <BqButton appearance="link" block size="small">Button</BqButton>
        </div>
      </BqDrawer>
    </>
  );
}
```

```ts Angular icon="angular" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
import { Component } from "@angular/core";
import { BqButton, BqDivider, BqDrawer, BqIcon } from "@beeq/angular/standalone";

@Component({
  selector: "app-root",
  standalone: true,
  imports: [BqButton, BqDivider, BqDrawer, BqIcon],
  template: `
    <bq-button (bqClick)="drawer.show()">Open Drawer</bq-button>

    <bq-drawer #drawer position="end" enable-backdrop>
      <div class="drawer-title" slot="title">
        <bq-icon name="user-circle" weight="bold"></bq-icon>
        Title
      </div>
      <div class="drawer-description">Content</div>
      <bq-divider class="drawer-footer-divider" slot="footer-divider" stroke-color="stroke--primary" stroke-thickness="1"></bq-divider>
      <div class="drawer-footer" slot="footer">
        <bq-button appearance="primary" block size="small">Button</bq-button>
        <bq-button appearance="link" block size="small">Button</bq-button>
      </div>
    </bq-drawer>
  `,
  styles: [`
    .drawer-title {
      display: flex;
      align-items: center;
      gap: var(--bq-spacing-xs);
    }

    .drawer-description {
      display: flex;
      height: 100%;
      align-items: center;
      justify-content: center;
      border-radius: var(--bq-radius--xs);
      border: 1px dashed var(--bq-stroke--brand);
      background-color: var(--bq-red-100);
    }

    .drawer-footer-divider {
      display: block;
      margin-bottom: var(--bq-spacing-m);
    }

    .drawer-footer {
      display: flex;
      justify-content: center;
      gap: var(--bq-spacing-xs);
      flex: 1;
    }
  `],
})
export class AppComponent {}
```

```vue Vue icon="vuejs" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
<script setup lang="ts">
import { ref } from "vue";
import { BqButton, BqDivider, BqDrawer, BqIcon } from "@beeq/vue";

const drawerRef = ref(null);
</script>

<template>
  <BqButton @bqClick="drawerRef?.show()">Open Drawer</BqButton>

  <BqDrawer ref="drawerRef" position="end" enableBackdrop>
    <div class="drawer-title" slot="title">
      <BqIcon name="user-circle" weight="bold" />
      Title
    </div>
    <div class="drawer-description">Content</div>
    <BqDivider class="drawer-footer-divider" slot="footer-divider" strokeColor="stroke--primary" :strokeThickness="1" />
    <div class="drawer-footer" slot="footer">
      <BqButton appearance="primary" block size="small">Button</BqButton>
      <BqButton appearance="link" block size="small">Button</BqButton>
    </div>
  </BqDrawer>
</template>

<style>
  .drawer-title {
    display: flex;
    align-items: center;
    gap: var(--bq-spacing-xs);
  }

  .drawer-description {
    display: flex;
    height: 100%;
    align-items: center;
    justify-content: center;
    border-radius: var(--bq-radius--xs);
    border: 1px dashed var(--bq-stroke--brand);
    background-color: var(--bq-red-100);
  }

  .drawer-footer-divider {
    display: block;
    margin-bottom: var(--bq-spacing-m);
  }

  .drawer-footer {
    display: flex;
    justify-content: center;
    gap: var(--bq-spacing-xs);
    flex: 1;
  }
</style>
```

### Close behavior

By default, clicking outside the panel or pressing `Esc` closes the drawer. Set `close-on-click-outside` or `close-on-esc` to prevent those interactions when the user must explicitly confirm before dismissing.

```css styles.css icon="css" theme={"theme":{"light":"one-light","dark":"night-owl"}}
.drawer-content {
  padding: var(--bq-spacing-m) 0;
}
```

```javascript JavaScript icon="js" theme={"theme":{"light":"one-light","dark":"night-owl"}}
const btn = document.querySelector('bq-button');
const drawer = document.querySelector('bq-drawer');
btn.addEventListener('bqClick', () => drawer.show());
```

```html HTML icon="html5" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
<bq-button>Open locked drawer</bq-button>

<bq-drawer position="end" enable-backdrop close-on-click-outside close-on-esc>
  <span slot="title">Unsaved changes</span>
  <div class="drawer-content">
    <p>Use the close button to dismiss.</p>
  </div>
</bq-drawer>
```

```jsx React icon="react" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
import { useRef } from "react";
import { BqButton, BqDrawer } from "@beeq/react";
import "./styles.css";

export default function App() {
  const drawerRef = useRef(null);

  return (
    <>
      <BqButton onBqClick={() => drawerRef.current?.show()}>Open locked drawer</BqButton>

      <BqDrawer ref={drawerRef} position="end" enableBackdrop closeOnClickOutside closeOnEsc>
        <span slot="title">Unsaved changes</span>
        <div className="drawer-content">
          <p>Use the close button to dismiss.</p>
        </div>
      </BqDrawer>
    </>
  );
}
```

```ts Angular icon="angular" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
import { Component } from "@angular/core";
import { BqButton, BqDrawer } from "@beeq/angular/standalone";

@Component({
  selector: "app-root",
  standalone: true,
  imports: [BqButton, BqDrawer],
  template: `
    <bq-button (bqClick)="drawer.show()">Open locked drawer</bq-button>

    <bq-drawer #drawer position="end" enable-backdrop close-on-click-outside close-on-esc>
      <span slot="title">Unsaved changes</span>
      <div class="drawer-content">
        <p>Use the close button to dismiss.</p>
      </div>
    </bq-drawer>
  `,
  styles: [`
    .drawer-content {
      padding: var(--bq-spacing-m) 0;
    }
  `],
})
export class AppComponent {}
```

```vue Vue icon="vuejs" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
<script setup lang="ts">
import { ref } from "vue";
import { BqButton, BqDrawer } from "@beeq/vue";

const drawerRef = ref(null);
</script>

<template>
  <BqButton @bqClick="drawerRef?.show()">Open locked drawer</BqButton>

  <BqDrawer ref="drawerRef" position="end" enableBackdrop closeOnClickOutside closeOnEsc>
    <span slot="title">Unsaved changes</span>
    <div class="drawer-content">
      <p>Use the close button to dismiss.</p>
    </div>
  </BqDrawer>
</template>

<style>
  .drawer-content {
    padding: var(--bq-spacing-m) 0;
  }
  </style>
```

## Best practices

> [card]
>
> Do
>
> Place drawers along the screen's edge — typically the right side — to prevent interference with navigational components on the left edge.

> [card]
>
> Don't
>
> Inset a drawer significantly from the screen edges. Doing so makes its position and scroll behaviour unclear and can obscure primary content.

> [card]
>
> Do
>
> Always provide a meaningful `title` slot so users and screen readers know the purpose of the panel before interacting with its content.

> [card]
>
> Don't
>
> Leave the title slot empty. A drawer without a title gives assistive technologies no label for the `role="dialog"` and leaves sighted users without orientation.

> [card]
>
> Do
>
> Use `enable-backdrop` when the drawer contains a form or a detail view that requires focused attention — it visually separates the panel from the underlying page.

> [card]
>
> Don't
>
> Use a drawer for critical, blocking confirmations such as destructive action prompts. Use `bq-dialog` for those — a drawer implies the page behind it is still accessible.

> [card]
>
> Do
>
> Place primary actions (Save, Apply, Confirm) in the `footer` slot so they are always accessible at the bottom of the panel, even when the body content is long and scrollable.

> [card]
>
> Don't
>
> Bury primary action buttons in the scrollable body. Users who do not scroll to the bottom will miss them and may not know how to complete the task.

> [card]
>
> Do
>
> Use `close-on-click-outside` and `close-on-esc` together when the panel contains unsaved changes that would be lost if the user accidentally dismisses it.

> [card]
>
> Don't
>
> Lock the close behavior by default on every drawer. Preventing Esc and outside-click dismissal frustrates users who expect those standard interactions to work.

## Accessibility

`bq-drawer` renders a `role="dialog"` panel with `aria-modal="true"` and `aria-labelledby` pointing to the built-in title element. When the drawer is closed, `aria-hidden="true"` is set on the panel so assistive technologies skip its content entirely.

The built-in close button has `label="Close"` and is announced by screen readers as "Close, button".

As a developer, you are responsible for the following:

* **Moving focus into the drawer when it opens** — the component does not trap focus automatically. When you call `show()`, you must move focus to the first interactive element inside the panel or to the panel itself so keyboard users can begin navigating immediately.
* **Returning focus to the trigger when the drawer closes** — after `hide()`, you must restore focus to the element that opened the drawer so keyboard users are not left disoriented.
* **Providing a descriptive title** — the `aria-labelledby` attribute references the title slot. Screen readers announce this text when the dialog opens, so you must not use an empty or generic title such as "Panel", which makes the dialog purpose unclear.
* **Keeping focusable elements out of the backdrop** — the backdrop does not receive focus, so you must keep interactive content inside the panel.

### Keyboard interaction

| Key | Context | Action |
| - | - | - |
| `Escape` | Drawer open, `close-on-esc` not set | Closes the drawer and emits `bqClose` |
| `Escape` | Drawer open, `close-on-esc` set | Does nothing; the drawer stays open |
| `Tab` / `Shift` + `Tab` | Drawer open | Follows the native tab order; focus is not trapped inside the drawer |
| `Enter` or `Space` | Focus on the close button or a native `<button>` inside the drawer | Activates the focused button |

### Rules

| Rule | Strength | Verified by |
| - | - | - |
| Move focus into the drawer after `show()`; the component does not trap focus | MUST | manual: open the drawer and inspect the next focused element |
| Restore focus to the trigger after `hide()` | MUST | manual: close the drawer and inspect where focus returns |
| Provide a descriptive title in the title slot | MUST | manual: read the title as the drawer accessible name |
| Do not use an empty or generic title such as "Panel" | MUST NOT | manual: review titles for a specific task or destination |
| Keep interactive content inside the panel, not the backdrop | MUST | manual: tab through the panel and check backdrop content is not interactive |

## API reference

### Properties

| Property | Attribute | Description | Type | Default |
| - | - | - | - | - |
| `closeOnClickOutside` | `close-on-click-outside` | If true, the drawer will not close when clicking outside the panel | `boolean` | `false` |
| `closeOnEsc` | `close-on-esc` | If true, the drawer will not close when the `Esc` key is pressed | `boolean` | `false` |
| `enableBackdrop` | `enable-backdrop` | If true, a backdrop overlay is shown when the drawer opens | `boolean` | `false` |
| `open` | `open` | If true, the drawer is visible | `boolean` | `false` |
| `position` | `position` | Defines the edge the drawer slides from | `'start' \| 'end'` | `'end'` |
| `placement` | `placement` | **Deprecated.** Use `position` instead. Defines the edge the drawer slides from | `'left' \| 'right'` | `'right'` |

### Invalid combinations

| Combination | Strength | Result |
| - | - | - |
| `placement` | MUST NOT | The deprecated prop logs a console warning and overrides `position`; use `position` instead |

### Methods

| Method | Description | Signature |
| - | - | - |
| `show()` | Opens the drawer and emits `bqOpen` | `show() => Promise<void>` |
| `hide()` | Closes the drawer and emits `bqClose` | `hide() => Promise<void>` |

### Events

| Event | Description | Type |
| - | - | - |
| `bqOpen` | Emitted when the drawer starts to open | `CustomEvent<void>` |
| `bqAfterOpen` | Emitted after the open animation completes | `CustomEvent<void>` |
| `bqClose` | Emitted when the drawer starts to close | `CustomEvent<void>` |
| `bqAfterClose` | Emitted after the close animation completes | `CustomEvent<void>` |

### Slots

| Slot | Description |
| - | - |
| *(default)* | The main body content of the drawer |
| `title` | The title displayed in the header |
| `footer` | Footer content — typically action buttons; only rendered when content is present |
| `button-close` | Custom content for the close button; defaults to a close icon |
| `footer-divider` | Content placed in the divider between body and footer |

### Shadow parts

| Part | Description |
| - | - |
| `backdrop` | The `<div>` holding the backdrop overlay |
| `panel` | The `<div>` holding the full drawer surface |
| `header` | The `<header>` holding the title and close button |
| `title` | The `<div>` that holds the title slot content |
| `button-close` | The `bq-button` wrapper for the close button |
| `button-close__btn` | The native `<button>` inside the close control |
| `button-close__label` | The label `<span>` inside the close button |
| `body` | The `<main>` holding the default slot content |
| `footer` | The `<footer>` holding footer slot content |

### CSS custom properties

**CSS variables**

| Variable | Description | Default |
| - | - | - |
| `--bq-drawer--background` | Background color of the drawer panel | `var(--bq-ui--primary)` |
| `--bq-drawer--backgroundBackdrop` | Background color of the backdrop overlay | `var(--bq-background--overlay)` |
| `--bq-drawer--gap` | Gap between the drawer panel and the viewport edge | `var(--bq-spacing-l)` |
| `--bq-drawer--width` | Width of the drawer panel | `320px` |
| `--bq-drawer--paddingX` | Inline (horizontal) padding of the panel | `var(--bq-spacing-l)` |
| `--bq-drawer--paddingY` | Block (vertical) padding of the panel | `var(--bq-spacing-m)` |
| `--bq-drawer--text-color` | Text color of the drawer panel | `var(--bq-text--primary)` |
| `--bq-drawer--zIndex` | Z-index of the drawer component | `10` |

> [!TIP]
>
> Learn more about [styling with shadow parts](https://www.beeq.design/guides/styles.md) and [CSS custom properties](https://www.beeq.design/theming/global-css-variables.md).

## Resources

> [card] [Interactive playground](https://storybook.beeq.design/?path=/story/components-drawer--default)
>
> Explore drawer variants and states in Storybook

> [card] [Source code](https://github.com/Endava/BEEQ/tree/main/packages/beeq/src/components/drawer)
>
> View the component source on GitHub


## Related topics

- [Changelog](https://www.beeq.design/releases/changelog.md)
- [React](https://www.beeq.design/guides/frameworks/react.md)
- [Colors](https://www.beeq.design/foundations/colors.md)
- [Dialog](https://www.beeq.design/components/dialog.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.