CSS components

Notification Center Dropdown Generator

Build the familiar bell icon with an unread count that opens a panel of notifications. Clicking a notification marks it as read and the badge updates automatically.

Live preview

Runs entirely in your browser. Nothing is uploaded to any server.

Why use this notification dropdown

Familiar pattern

People instantly understand a bell with a red count.

Keeps state honest

The badge and label always match the unread items.

Accessible

aria-expanded, Escape to close and focus returns to the bell.

How to build a notification center

  1. Add notificationsOne per line with title, message and time separated by |.
  2. Set unread and styleChoose how many are unread, the theme, alignment and colours.
  3. Copy the codeCopy the snippets into your header and wire them to your data.

How the dropdown is built

The bell is a real button with aria-expanded and aria-controls pointing at the panel. The panel is shown with opacity, visibility and a small transform, so it animates smoothly and stays out of the tab order while closed.

Unread items carry an is-unread class. The script counts them to update the badge and the accessible label of the bell, and hides the mark-all button once everything is read. When the list is empty, an "all caught up" message appears through a pure CSS :empty rule.

Badge

Hidden automatically with :empty when the count is zero.

Outside click

Clicking anywhere else on the page closes the panel.

Dark mode

Switch to a dark panel that suits dark app headers.

Notification dropdown FAQ

How do I load real notifications?

Render the list items from your server or build them in JavaScript from an API response, then call the refresh function to update the badge.

Can I link each notification to a page?

Yes. Replace the button with class nc-link with an a element that has the same class and an href.

How do I persist the read state?

Send a request to your server inside the click handlers, or store read IDs in localStorage.

Why does the panel overflow on phones?

It is limited to the screen width minus 24px. If the bell is near the left edge, choose the left aligned option.

Does it need a framework?

No. It is plain HTML, CSS and about 40 lines of JavaScript.

Try other CSS component tools

More free tools from My Panda Toolbox.