Bootstrap 5 Account Dropdown Menu
An account dropdown menu with a profile header, icon links, an activity badge and a sign-out action.
<section class="wdw-stage">
<div class="container d-flex justify-content-center" style="min-height: 34rem;">
<div class="dropdown-center wdw-account" id="accountDropdown">
<button class="btn wdw-acct-btn rounded-pill d-inline-flex align-items-center gap-2 ps-2 pe-3 dropdown-toggle" type="button" id="accountBtn" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false">
<img src="https://i.pravatar.cc/80?img=32" alt="" width="32" height="32" class="rounded-circle">
<span class="fw-semibold">Elena Marsh</span>
</button>
<ul class="dropdown-menu shadow border-0 p-2 mt-3" aria-labelledby="accountBtn">
<li class="px-3 py-3 d-flex align-items-center gap-3">
<span class="position-relative flex-shrink-0">
<img src="https://i.pravatar.cc/80?img=32" alt="" width="56" height="56" class="rounded-circle d-block">
<span class="wdw-status" title="Online"><span class="visually-hidden">Online</span></span>
</span>
<div class="lh-sm">
<p class="fw-bold mb-1 fs-5">Elena Marsh</p>
<p class="small text-body-secondary mb-0">[email protected]</p>
</div>
</li>
<li class="px-3 pb-3">
<div class="d-flex justify-content-between small mb-1"><span class="fw-semibold">Pro plan</span><span class="text-body-secondary">7.2 of 10 GB</span></div>
<div class="progress" role="progressbar" aria-label="Storage used" aria-valuenow="72" aria-valuemin="0" aria-valuemax="100" style="height:.5rem"><div class="progress-bar" style="width:72%"></div></div>
</li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item rounded-3 d-flex align-items-center gap-3 py-2" href="#"><svg class="flex-shrink-0" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/></svg>Your profile<kbd class="ms-auto wdw-kbd">G P</kbd></a></li>
<li><a class="dropdown-item rounded-3 d-flex align-items-center gap-3 py-2" href="#"><svg class="flex-shrink-0" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3" width="7" height="9" rx="1.5"/><rect x="14" y="3" width="7" height="5" rx="1.5"/><rect x="14" y="12" width="7" height="9" rx="1.5"/><rect x="3" y="16" width="7" height="5" rx="1.5"/></svg>Your dashboard<kbd class="ms-auto wdw-kbd">G D</kbd></a></li>
<li><a class="dropdown-item rounded-3 d-flex align-items-center gap-3 py-2" href="#"><svg class="flex-shrink-0" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12h4l3-8 4 16 3-8h4"/></svg>Recent activity <span class="badge text-bg-primary rounded-pill ms-auto">3</span></a></li>
<li><a class="dropdown-item rounded-3 d-flex align-items-center gap-3 py-2" href="#"><svg class="flex-shrink-0" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/></svg>Settings<kbd class="ms-auto wdw-kbd">G S</kbd></a></li>
<li><hr class="dropdown-divider"></li>
<li class="px-3 py-2 d-flex align-items-center justify-content-between gap-3">
<span class="small fw-semibold" id="acctThemeLabel">Theme</span>
<div class="btn-group wdw-seg" role="group" aria-labelledby="acctThemeLabel">
<input type="radio" class="btn-check" name="acctTheme" id="acctLight" value="light" autocomplete="off">
<label class="btn btn-sm btn-outline-secondary" for="acctLight">Light</label>
<input type="radio" class="btn-check" name="acctTheme" id="acctDark" value="dark" autocomplete="off">
<label class="btn btn-sm btn-outline-secondary" for="acctDark">Dark</label>
</div>
</li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item rounded-3 d-flex align-items-center gap-3 py-2 wdw-signout" href="#"><svg class="flex-shrink-0" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9"/></svg>Sign out<kbd class="ms-auto wdw-kbd">⇧Q</kbd></a></li>
</ul>
</div>
</div>
</section>
/* Web Designer Wall library style — shared base for every Bootstrap 5 snippet.
Indigo accent, Plus Jakarta Sans, soft cards, pill buttons. Works in light and dark. */
@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");
:root,
[data-bs-theme="light"] {
--wdw-font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
--bs-body-font-family: var(--wdw-font);
--bs-primary: #4f46e5;
--bs-primary-rgb: 79, 70, 229;
--bs-primary-text-emphasis: #3730a3;
--bs-primary-bg-subtle: #eef2ff;
--bs-primary-border-subtle: #c7d2fe;
--bs-link-color: #4f46e5;
--bs-link-color-rgb: 79, 70, 229;
--bs-link-hover-color: #4338ca;
--bs-link-hover-color-rgb: 67, 56, 202;
--bs-focus-ring-color: rgba(79, 70, 229, 0.25);
--bs-border-radius: 0.75rem;
--bs-border-radius-lg: 1rem;
--bs-border-radius-xl: 1.25rem;
--wdw-radius-card: 1.25rem;
--wdw-shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 16px 40px -16px rgba(16, 24, 40, 0.22);
--wdw-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 12px -4px rgba(16, 24, 40, 0.12);
--wdw-stage: #f5f6fb;
}
[data-bs-theme="dark"] {
--bs-primary: #818cf8;
--bs-primary-rgb: 129, 140, 248;
--bs-primary-text-emphasis: #c7d2fe;
--bs-primary-bg-subtle: rgba(129, 140, 248, 0.14);
--bs-primary-border-subtle: rgba(129, 140, 248, 0.35);
--bs-link-color: #a5b4fc;
--bs-link-color-rgb: 165, 180, 252;
--bs-link-hover-color: #c7d2fe;
--bs-link-hover-color-rgb: 199, 210, 254;
--bs-focus-ring-color: rgba(129, 140, 248, 0.35);
--wdw-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -16px rgba(0, 0, 0, 0.7);
--wdw-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px -4px rgba(0, 0, 0, 0.5);
--wdw-stage: #0f1117;
}
body { font-family: var(--wdw-font); -webkit-font-smoothing: antialiased; }
/* Bootstrap compiles its blue into these components; point them at the accent. */
.btn-primary {
--bs-btn-bg: var(--bs-primary); --bs-btn-border-color: var(--bs-primary);
--bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca;
--bs-btn-active-bg: #3730a3; --bs-btn-active-border-color: #3730a3;
--bs-btn-disabled-bg: var(--bs-primary); --bs-btn-disabled-border-color: var(--bs-primary);
--bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #0f1117; --bs-btn-hover-bg: #a5b4fc; --bs-btn-hover-border-color: #a5b4fc; --bs-btn-hover-color: #0f1117; --bs-btn-active-color: #0f1117; }
.btn-outline-primary {
--bs-btn-color: var(--bs-primary); --bs-btn-border-color: var(--bs-primary);
--bs-btn-hover-bg: var(--bs-primary); --bs-btn-hover-border-color: var(--bs-primary);
--bs-btn-active-bg: var(--bs-primary); --bs-btn-active-border-color: var(--bs-primary);
--bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
.btn { --bs-btn-font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
.btn-sm { min-height: 36px; }
.form-control, .form-select { min-height: 44px; border-radius: .75rem; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: rgba(var(--bs-primary-rgb), .6); box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.form-check-input:checked { background-color: var(--bs-primary); border-color: var(--bs-primary); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--bs-primary); }
.nav { --bs-nav-link-color: var(--bs-secondary-color); --bs-nav-link-hover-color: var(--bs-emphasis-color); }
.pagination { --bs-pagination-active-bg: var(--bs-primary); --bs-pagination-active-border-color: var(--bs-primary); --bs-pagination-color: var(--bs-body-color); --bs-pagination-focus-box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.progress, .progress-stacked { --bs-progress-bar-bg: var(--bs-primary); }
.list-group { --bs-list-group-active-bg: var(--bs-primary); --bs-list-group-active-border-color: var(--bs-primary); }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--bs-primary); border-radius: .875rem; box-shadow: var(--wdw-shadow-sm); }
.accordion { --bs-accordion-active-bg: var(--bs-primary-bg-subtle); --bs-accordion-active-color: var(--bs-primary-text-emphasis); --bs-accordion-btn-focus-box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.badge { font-weight: 600; }
/* Library building blocks — use these instead of re-inventing them per snippet. */
.wdw-stage { min-height: 100vh; display: flex; align-items: center; background: var(--wdw-stage); padding-block: 3rem; }
.wdw-card { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: var(--wdw-radius-card); box-shadow: var(--wdw-shadow); }
.wdw-card-sm { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: 1rem; box-shadow: var(--wdw-shadow-sm); }
.wdw-aurora { position: relative; color: #fff; background: radial-gradient(60% 55% at 100% 0, #818cf8 0, transparent 70%), radial-gradient(65% 60% at 0 100%, #ec4899 0, transparent 65%), #1e1b4b; }
.wdw-eyebrow { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--bs-primary); }
.wdw-heading { font-weight: 800; letter-spacing: -.02em; color: var(--bs-emphasis-color); }
.wdw-muted { color: var(--bs-secondary-color); }
.wdw-icon { width: 2.75rem; height: 2.75rem; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: .875rem; background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }
/* Component */
.wdw-account .dropdown-menu { min-width: 24rem; font-size: 1rem; }
.wdw-acct-btn {
--bs-btn-color: var(--bs-body-color); --bs-btn-bg: var(--bs-body-bg); --bs-btn-border-color: var(--bs-border-color);
--bs-btn-hover-bg: var(--bs-tertiary-bg); --bs-btn-hover-border-color: var(--bs-border-color); --bs-btn-hover-color: var(--bs-body-color);
--bs-btn-active-bg: var(--bs-secondary-bg); --bs-btn-active-border-color: var(--bs-border-color); --bs-btn-active-color: var(--bs-body-color);
--bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
min-height: 48px; box-shadow: var(--wdw-shadow-sm);
}
.wdw-acct-btn.show, .wdw-acct-btn.show:focus { background: var(--bs-secondary-bg); box-shadow: var(--wdw-shadow-sm); }
.wdw-acct-btn:focus-visible { box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.wdw-account .dropdown-item { --bs-dropdown-link-hover-bg: var(--bs-primary-bg-subtle); min-height: 44px; }
.wdw-account .dropdown-item:active { color: var(--bs-body-color); background: var(--bs-primary-bg-subtle); }
.wdw-account .wdw-signout { color: var(--bs-danger-text-emphasis); }
.wdw-account .wdw-signout:hover { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.wdw-status { position: absolute; right: 0; bottom: 0; width: .85rem; height: .85rem; border-radius: 50%; background: var(--bs-success); border: 2px solid var(--bs-body-bg); }
.wdw-kbd { font-size: .72rem; padding: .15rem .45rem; border-radius: .4rem; background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); border: 1px solid var(--bs-border-color); }
.wdw-seg .btn { --bs-btn-hover-color: var(--bs-body-color); --bs-btn-hover-bg: var(--bs-tertiary-bg); --bs-btn-active-bg: var(--bs-primary); --bs-btn-active-border-color: var(--bs-primary); --bs-btn-active-color: #fff; min-height: 36px; border-radius: 999px; }
[data-bs-theme="dark"] .wdw-seg .btn { --bs-btn-active-color: #0f1117; }
.wdw-seg .btn:first-of-type { border-radius: 999px 0 0 999px; }
.wdw-seg .btn:last-of-type { border-radius: 0 999px 999px 0; }
(function initAccountDropdown() {
var btn = document.getElementById('accountBtn');
if (!btn || !window.bootstrap) return;
// Show the menu once on load so the component is visible at a glance.
bootstrap.Dropdown.getOrCreateInstance(btn).show();
})();
(function initAccountTheme() {
var root = document.documentElement;
var radios = document.querySelectorAll('input[name="acctTheme"]');
if (!radios.length) return;
var current = root.getAttribute('data-bs-theme') === 'dark' ? 'dark' : 'light';
radios.forEach(function (r) {
r.checked = r.value === current;
r.addEventListener('change', function () { root.setAttribute('data-bs-theme', r.value); });
});
})();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.