Skip to content

Notifications Dropdown with User Photos

Bootstrap 5 navbar bell dropdown listing notifications with user photos, activity icons, times, unread dots and a mark-all-as-read action.

Also known as: notification bell dropdown, notification center menu, navbar notifications list, activity feed dropdown, unread notifications badge

Notifications Dropdown with User Photos live demo

Open in new tab

Bootstrap 5 code (HTML, CSS, JS)

A Bootstrap 5 notifications dropdown that opens from a bell icon in a dark navbar and lists recent activity with user photos, short messages, activity icons, relative times and unread dots. It fits dashboards, SaaS apps, community sites and any admin header that needs a notification center.

How it works

The wrapper .ntf-shell holds a navbar and a decorative page placeholder (.ntf-page). The bell is a button.ntf-bell with data-bs-toggle="dropdown" and data-bs-auto-close="outside", so clicks inside the menu do not close it. Because the dropdown sits inside a .navbar, Bootstrap positions the .dropdown-menu-end menu with CSS instead of Popper. Below 576px .ntf-dropdown becomes position: static and the .ntf-menu stretches across the navbar.

The menu has a .ntf-head with the title and the .ntf-mark-all button, a scrollable ul.ntf-list and a .ntf-foot link. Each a.ntf-item contains a round .ntf-photo, a .ntf-body with .ntf-text and .ntf-time, and a .ntf-dot. Unread items carry .ntf-item--unread, which tints the row and fills the dot.

The script runs on DOMContentLoaded for every .ntf-dropdown. Its update() function counts the unread items, writes the number into .ntf-badge (hidden at zero, "9+" above nine), updates the bell's aria-label and disables .ntf-mark-all when nothing is left. Clicking an unread item removes the class; clicking "Mark all as read" clears them all. If the dropdown has data-ntf-open, the menu is opened on page load with bootstrap.Dropdown.getOrCreateInstance(...).show().

The user photos come from Unsplash; replace them with your users' own avatars.

Customization

  • --ntf-bar and --ntf-accent in .ntf-shell: change the navbar color and the accent used for links, dots and focus rings.
  • --ntf-accent-soft in .ntf-shell: sets the background of unread rows.
  • --ntf-menu-width in .ntf-shell: make the menu wider or narrower on larger screens.
  • max-height: 28rem in .ntf-list: limit how many rows show before the list scrolls.
  • Remove data-ntf-open from .ntf-dropdown so the menu stays closed until the bell is clicked.
  • Add or remove .ntf-item--unread on an .ntf-item to set the initial unread state; the badge updates itself.
  • The .ntf-type--comment, .ntf-type--mention and similar classes: recolor the small activity icons.
  • The comment in the .ntf-mark-all click handler in script.js: add your fetch() call to save the read state.

Use cases

  • SaaS dashboards: a bell in the navbar opens recent activity with user photos and times
  • Community sites: unread dots and a badge count show new comments and mentions
  • Admin headers: a Mark all as read button clears every unread item at once
  • Web apps: the badge and the bell label update automatically as items are read

Accessibility

The bell is a native button with an aria-label such as "Notifications, 3 unread", and the visual badge is aria-hidden. Bootstrap manages aria-expanded, Escape to close and arrow-key navigation between the links. Each unread row includes a visually-hidden "Unread" label that is removed when the row is read. A role="status" element announces "Marked as read" and "All notifications marked as read". Focus rings are visible on the bell, rows, footer and button, photos have the user's name as alt, and the hover transition is disabled with prefers-reduced-motion: reduce.

Usage notes

Requires Bootstrap 5 with its JavaScript bundle and Bootstrap Icons. Replace the # links with real URLs; the script only prevents navigation for href="#".

Notifications Dropdown with User Photos at a glance

Framework
Bootstrap 5
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Bootstrap 5, Bootstrap Icons
Layout
Responsive, works on mobile
Category
Dropdowns
License
Free for personal and commercial use

Questions about this template

Can I use the Notifications Dropdown with User Photos code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Bootstrap 5 and Bootstrap Icons from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
  • <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
Notifications Dropdown with User Photos – free Bootstrap 5 dropdown template
Notifications Dropdown with User Photos · free Bootstrap 5 dropdown template

More Dropdowns

Hover and Focus Dropdown – free Pure CSS dropdown template

Hover and Focus Dropdown

Dark navbar with pure CSS dropdown menus that open on hover and keyboard focus, plus a small vanilla JS layer for Escape, arrow keys and touch taps.

User Account Dropdown – free Bootstrap 5 dropdown template

User Account Dropdown

Bootstrap 5 avatar dropdown with profile header, plan badge, online/away/busy status picker and account menu links for app headers.

Dropdown Menu with Icons – free Tailwind CSS dropdown template

Dropdown Menu with Icons

Accessible Tailwind CSS menu button with icons, grouped items, dividers, shortcut hints, typeahead and full arrow-key navigation.