A Bootstrap 6 user account menu that opens from an avatar button in an app header. The menu has a profile card with name, email and plan badge, a "Set status" submenu, account links, a dark mode switch and a sign-out item. It fits SaaS dashboards, note apps and any product with signed-in users.
How it works
The avatar .uam-trigger is a button with data-bs-toggle="menu", data-bs-placement="bottom-end" and data-bs-auto-close="outside". The last setting keeps the menu open while you change your status or the theme. Both avatars use the Bootstrap 6 .avatar component with an .avatar-status dot.
The status picker uses the new .submenu wrapper: a .menu-item trigger followed by a nested .uam-status-menu. On desktop the plugin opens it on hover, click or the Right arrow key, and flips it to the left when there is no room on the right. Below 576 px, style.css makes the submenu expand inline inside the main menu, because alpha.1 would place it off-screen. Each option shows .menu-item-check only while it has .selected.
script.js handles the rest. Choosing a status swaps the status-online, status-away or status-busy class on every .uam-status-dot, updates .uam-status-label and the trigger's aria-label, and announces the change in .uam-live. The .uam-theme item is a role="switch" button. It flips aria-checked and sets data-bs-theme on .uam-root, so Bootstrap tokens and the component's own variables switch to dark. Link items close the menu with Menu.getOrCreateInstance(trigger).hide(). For the preview, the menu opens on load and .uam-instant skips its fade-in.
Customization
- Remove
data-uam-open-on-loadfrom.uam-rootso the menu starts closed. --uam-brandand--uam-brand-softon.uam-root: change the logo, hover, switch and profile card tint. The dark values sit in.uam-root[data-bs-theme="dark"].--bs-menu-item-padding-yandmin-widthon.uam-menu: make the menu denser or wider.STATUS_TEXTinscript.js: rename the statuses or add one (add a matching.uam-dot--*color).- Replace
preventDefault()in the.uam-gohandler with real navigation, and hook the theme switch to your own saved preference. - Change
theme-successon.uam-planto show another plan color.
Use cases
- App headers: an avatar opens a menu with a profile header and account links
- Chat and team tools: a presence status submenu lets people set their availability
- SaaS dashboards: a dark mode switch inside the menu changes the appearance
- Logged-in websites: a sign-out item ends the session from one place
Accessibility
The trigger's aria-label names the user and current status, and the plugin keeps aria-expanded current on the trigger and the submenu toggle. Arrow keys move through items, Right and Left open and close the submenu, and Escape closes the menu and returns focus to the avatar. The theme item is a switch with aria-checked, and selected statuses carry aria-current. Status changes are announced in a polite live region. Decorative icons and dots are aria-hidden, and transitions stop under prefers-reduced-motion.
Bootstrap 6 notes
Bootstrap 5's .dropdown-menu-end is data-bs-placement="bottom-end", and nested menus are now built in with .submenu. Avatars use the new .avatar and .avatar-status classes, and badges use badge badge-subtle theme-success. Built on Bootstrap 6.0.0-alpha.1, so alpha APIs can still change. Icons come from Bootstrap Icons, and the portrait is from Unsplash; replace it with your users' own photos.