--- title: Drawer desc: Drawer is a grid layout that can show/hide a sidebar on the left or right side of the page. layout: components classnames: component: - class: drawer desc: The wrapper for sidebar and content part: - class: drawer-toggle desc: The hidden checkbox that controls the state of drawer - class: drawer-content desc: Content part - class: drawer-side desc: Sidebar part - class: drawer-overlay desc: Label that covers the page when drawer is open placement: - class: drawer-end desc: puts drawer to the other side modifier: - class: drawer-open desc: Forces the drawer to be open --- ### Structure Drawer is a grid layout that can show/hide a sidebar on the left or right side of the page, based on the screen size or based on the value of a `drawer-toggle` checkbox. Drawer must be the parent element of the content and sidebar. ```json:Structure .drawer // The root container ├── .drawer-toggle // A hidden checkbox to toggle the visibility of the sidebar ├── .drawer-content // All your page content goes here │ ╰── // navbar, content, footer │ ╰── .drawer-side // Sidebar wrapper ├── .drawer-overlay // A dark overlay that covers the whole page when the drawer is open ╰── // Sidebar content (menu or anything) ``` ### Functionality Drawer sidebar is hidden by default. You can make it visible on larger screens using `lg:drawer-open` class (or using other responsive prefixes: sm, md, lg, xl) You can check/uncheck the checkbox using JavaScript or by clicking the `label` tag which is assigned to the hidden checkbox > :INFO: > > Opening a drawer adds a [scrollbar-gutter](https://developer.mozilla.org/en-US/docs/Web/CSS/scrollbar-gutter) to the page to avoid layout shift on operating systems that have a fixed scrollbar. > If you don't want to use this feature, [you can exclude `rootscrollgutter`](/docs/config/#exclude). ### ~Drawer