Drawer

Drawer is a flexible component for off-canvas panels, sidebars, and overlays. It supports manual and programmatic control, named instances, and can be positioned at the start or end of the viewport.

Basic Usage

This is a basic Drawer example. Click the button to open the sidebar, and use the sidebar button to close it. DrawerContent and DrawerSide are direct children of Drawer. Remove the positioning classes from this example to use it in your app:

Code Example
Basic.vue

Components

The Drawer components include the following:

  • Drawer - The wrapper. Its props control appearance and behavior.
  • DrawerContent - Contains the main content of the Drawer.
  • DrawerSide - Contains the side content and overlay.

Drawer

The Drawer component is the wrapper. It syncs its open state and provides context for DrawerContent and DrawerSide. Use the open prop for manual control, and end to position the drawer at the end (right).

Drawer Props Type Description
open
boolean
v-model Allows manual control of the open/closed state.
name
string

Unique name/id for the Drawer instance. Used to sync state between Drawer, DrawerContent, and DrawerSide. Default: drawer.

end
boolean

Positions the drawer at the end (right) side of the screen.

Drawer Events Arguments Description
update:open
v-model Emitted when the open state changes.
Drawer Slots Description
default

The default slot. Must contain DrawerContent and DrawerSide as direct children.

Drawer Provides Type Description
isDrawerOpen
boolean

Whether the drawer is open or closed.

closeDrawer
Function

Closes the drawer.

openDrawer
Function

Opens the drawer.

DrawerContent

Contains the main content of the Drawer. Use inside a Drawer wrapper.

DrawerContent Props Type Description
name
string

Unique name/id for the Drawer instance. Default: drawer.

DrawerContent Slots Description
default

Slot for your main content. Receives drawer state as slot props.

DrawerSide

Contains the side content and overlay. Use inside a Drawer wrapper. Clicking the overlay will close the drawer.

DrawerSide Props Type Description
name
string

Unique name/id for the Drawer instance. Default: drawer.

DrawerSide Slots Description
default

Slot for your sidebar content. Receives drawer state as slot props.

Examples

End (Right Side)

Code Example
End.vue

This example shows the Drawer positioned at the end (right) side of the viewport using the right prop.

Mobile

Code Example
Mobile.vue

This example demonstrates the Drawer in mobile mode, where it is always open on desktop and overlays on mobile.