About this set
Sidebars that leave the screen on small devices and slide back in when asked. The responsive one is a logistics dashboard: from 992px wide it is a normal sidebar inside the layout, and below that the same element becomes a drawer opened from a menu button in the top bar, with a close button in its header and a dimmed backdrop behind it. The phone app is a travel app whose menu is a drawer at every width, with the member’s card, counts for saved places and messages, and Settings and Sign out at the bottom. In plain CSS and Tailwind the drawer is an element with the popover attribute, opened by a button with popovertarget, so it needs no script: the browser handles Esc and clicks outside, and @starting-style with transition-behavior: allow-discrete animates it in and out. The Bootstrap version uses the Offcanvas component instead, .offcanvas-lg for the responsive sidebar and .offcanvas for the phone app, restyled through its –bs-offcanvas-* variables. Use the responsive pattern for dashboards and the always-drawer pattern for mobile-first apps.
What’s included
- One element that is a sidebar from 992px and a drawer below
- Popover drawer with no JavaScript in plain CSS and Tailwind
- Slide-in and slide-out with @starting-style
- Closes on Esc, outside click and a close button
- Bootstrap .offcanvas-lg and .offcanvas, restyled through variables
Accessibility
The menu and close buttons are real buttons with aria-labels, and browsers expose the popover button's expanded state. The popover drawer closes with Esc or an outside click and sits right after its button in the Tab order; the Bootstrap offcanvas moves focus into the panel and keeps it there until it closes. Current pages use aria-current="page", focus outlines are visible, and the slide animation is removed under prefers-reduced-motion.
Customise it
Change the --oc-* custom properties for colours, the drawer width in width:min(300px,86vw), and the 992px breakpoint in the media query. In Bootstrap set --bs-offcanvas-width and the other --bs-offcanvas-* variables on .oc; in Tailwind edit the w-[…] and min-[992px]: utilities.





