Before getting started with Bootstrap's drawer component, be sure to read the following points.
- Drawers are build with HTML, CSS, and JavaScript. They're positioned over everything else in the document and remove scroll from the
<body>
so that drawer content scrolls instead. - Clicking on the drawer "backdrop" will automatically close the drawer.
- Bootstrap only supports one drawer window at a time. Nested drawers aren't supported as we believe them to be poor user experiences.
- Drawer use
position: fixed
, which can sometimes be a bit particular about its rendering. Whenever possible, place your drawer HTML in a top-level position to avoid potential interference from other elements. You'll likely run into issues when nesting a.drawer
within another fixed element. - Once again, due to
position: fixed
, there are some caveats with using drawers on mobile devices. - Due to how HTML5 defines its semantics, the
autofocus
HTML attribute has no effect in Bootstrap drawers. To achieve the same effect, use some custom JavaScript:
Keep reading for demos and usage guidelines.