Skip to content

Drawer

A sliding panel that appears from the edge of the screen to display content.

First release: 1.0.0 Latest update: July 1, 2025 Current version: 1.0.0

React Angular Vue Svelte HTML

Import

import { PlusDrawer } from '@plusui/react';
import { PlusDrawerComponent } from '@plusui/angular';
import { PlusDrawer } from '@plusui/vue';
import PlusDrawer from '@plusui/svelte';
<script src="https://cdn.jsdelivr.net/npm/@plusui/core"></script>

Package

@plusui/react
@plusui/angular
@plusui/vue
@plusui/svelte
@plusui/core

Docs

Changelog

Drawer Changelog

Recent changes and updates for the drawer component

v1.0.0

June 20, 2025
Feat

Added Drawer component for side panels

  • 4 positions: left, right, top, bottom
  • Multiple sizes: sm, md, lg
  • Custom header, body, and footer slots
  • Smooth animations
  • Accessibility support

The Drawer component provides a flexible way to display navigation, forms, details, or other supplementary content in a panel that slides in from the edge of the viewport. It helps manage screen real estate effectively.

Drawer - anatomy

Use the show() and hide() methods to programmatically open and close the drawer. The isOpen property reflects the current state.

Open Drawer
Drawer Title

This is the main content of the drawer.

Close Drawer
Footer Content
Show code
Show console

The orientation prop determines which edge the drawer slides in from.

LeftRight (Default)TopBottom
Orientation Example
Content
Show code

The size prop controls the width (for left/right) or height (for top/bottom) of the drawer.

SmallMedium (Default)Large
Size Example
Content
Show code

Use the header, body, and footer slots to structure the drawer content. The default close button can be replaced using the close slot.

Open Custom DrawerCustom Header

This is the body slot content.

Put any HTML here.

CloseSave
Show code
Drawer - layout spacing Drawer - light & dark mode
  • Keyboard Behavior:
    • When the drawer is open, pressing Escape will close it.
    • Focus is typically managed within the drawer. When opened, focus should ideally move to the first focusable element inside the drawer or the close button. When closed, focus should return to the element that triggered the drawer.
  • Screen Reader:
    • The component uses role="dialog" and aria-modal="true" to indicate its purpose and that interaction should be limited to the drawer when open.
    • aria-hidden is toggled based on the isOpen state.
    • An aria-label="Drawer" is provided by default. It’s recommended to provide a more specific label via aria-labelledby pointing to the header content if possible, or by setting aria-label directly on the plus-drawer element if the header slot is not used or needs overriding.
    • The close button has an aria-label="Close drawer".
  • Required Developer Actions:
    • Ensure the drawer has a clear focus management strategy. While the component handles basic Esc key closing, managing focus trapping and return focus might require additional application-level logic, especially in complex scenarios.
    • Provide meaningful content within the header, body, and footer slots.
    • If the default aria-label="Drawer" is not descriptive enough for the specific use case, provide a more informative label using aria-label or aria-labelledby on the plus-drawer element.
Site favicon Plus UI Design System on Figma
Visit
NameTypeDefaultDescriptionRequired
size'sm' | 'md' | 'lg''md'Controls the width (left/right) or height (top/bottom) of the drawer.No
isOpenbooleanfalseWhether the drawer is currently open. Use show()/hide() methods.No
orientation'left' | 'right' | 'top' | 'bottom''right'The edge from which the drawer slides in.No
animationDurationnumber300The duration of the open/close animation in milliseconds.No
NameParametersReturnsDescription
show()—voidOpens the drawer.
hide()—voidCloses the drawer.
NamePayload TypeDescription
plus-drawer-before-showCustomEvent<void>Fired just before the show animation starts.
plus-drawer-showCustomEvent<void>Fired after the show animation completes.
plus-drawer-before-hideCustomEvent<void>Fired just before the hide animation starts.
plus-drawer-hideCustomEvent<void>Fired after the hide animation completes.
NameDescription
headerContent for the drawer’s header area.
bodyThe main content area of the drawer.
footerContent for the drawer’s footer area.
closeCustom content for the close button (replaces default icon).
default (unnamed)Alternative slot for the main content (appended after body).
PartDescription
containerThe main container element (host + overlay).
overlayThe backdrop overlay element.
drawerThe sliding drawer panel itself.
headerThe header section of the drawer.
bodyThe main content body of the drawer.
footerThe footer section of the drawer.
close-buttonThe close button element.

Join the Community

Plus UI is built by the community. Join us on our platforms to contribute, get help, and stay up to date.