A dark Bootstrap 6 admin sidebar with a user profile block, grouped icon navigation, a collapsible Products submenu and an "Upgrade to Pro" card with a storage meter. On desktop it is a fixed column next to the dashboard. Below 1024 px the same markup becomes a Bootstrap 6 Drawer that slides in from the left.
How it works
The sidebar is one <dialog class="drawer drawer-start lg:drawer dds-side">. The responsive lg:drawer class keeps it static and always visible from the lg breakpoint up, and turns it into a modal drawer below that. The hamburger button .dds-open (hidden on desktop with lg:d-none) opens it through the data API with data-bs-toggle="drawer". The drawer header with the close button is only shown on small screens, and the desktop logo .dds-brand-desk is only shown on large ones.
Inside .dds-inner you find the brand, the .dds-profile card with a Bootstrap 6 .avatar and .avatar-status.status-online, two labelled ul.nav.flex-column lists, and the .dds-upgrade card. Badges use badge theme-accent. The Products item is a Bootstrap Collapse trigger. Its chevron .dds-caret rotates through an [aria-expanded="true"] selector, because Bootstrap 6 no longer adds a .collapsed class.
script.js keeps aria-expanded on the hamburger in sync with the drawer's show.bs.drawer and hidden.bs.drawer events, which the alpha data API does not do. It also moves .active and aria-current="page" to the clicked link, copies its label into .dds-title, and closes the drawer after a choice on mobile.
Customization
--dds-accentand--dds-accent-2on.dds-root: change the active link glow, the logo gradient, the storage bar and the chart highlight.--dds-side,--dds-bgand--dds-panelon.dds-root: set the sidebar, page and card surfaces.--dds-side-widthon.dds-root: makes the desktop column wider or narrower (16.5rem by default).widthon.dds-progress-bar(andaria-valuenowon.dds-progress): shows a different storage level.- Change
lg:drawertomd:draweron.dds-sideand the1024pxmedia queries instyle.cssandscript.jsto768pxto keep the sidebar visible on tablets. - Remove
preventDefault()in the link click handler when the links point to real pages.
Use cases
- Dark-mode dashboards: a user profile and grouped icon navigation sit in one side panel
- SaaS apps: a collapsible submenu keeps related pages together
- Freemium products: an upgrade card in the sidebar points free users to a paid plan
- Responsive admin layouts: the sidebar becomes a drawer on mobile
Accessibility
The sidebar dialog has aria-label="Main navigation", and each list is labelled by its visible section heading. The current page uses aria-current="page". The collapse trigger has aria-expanded and aria-controls. Icons are aria-hidden, the unread dot has a text label, and the storage meter is a progressbar with values. In drawer mode, focus is trapped in the native dialog and Escape closes it. Links have a visible teal focus ring, and the caret animation stops under prefers-reduced-motion.
Bootstrap 6 notes
Bootstrap 5's offcanvas-lg is now lg:drawer on a native <dialog class="drawer">, opened with data-bs-toggle="drawer". d-lg-none became lg:d-none, bg-primary badges are badge theme-accent, and avatars are the new .avatar component. Built on Bootstrap 6.0.0-alpha.1, so alpha APIs can still change. Icons come from Bootstrap Icons, and the avatar photo is from Unsplash; replace it with your own image.