About this set
A bell panel and two toasts that work without any component JavaScript. The panel is an element with the popover attribute, opened by a bell with popovertarget, so the browser handles Esc, clicks outside and the bell’s expanded state. CSS anchor positioning pins it under the bell with anchor() and position-try-fallbacks; browsers without anchor positioning place it at the top right through an @supports rule, and on phones it spans the screen width. It fades and slides in with @starting-style, and display and overlay transition with allow-discrete so it animates out as well. Mark all as read is a checkbox styled as a button: :has() on the panel and header reads its state to hide the count badge and unread dots and show a You’re all caught up line. The toasts are popover=”manual” elements opened by Copy invite link and Watch this thread, each anchored just above the button that raised it and closed by its own button. The demo page runs one demo-only line to open the panel and a toast for the preview; the component needs none.
What’s included
- popover="auto" panel with built-in Esc, light dismiss and expanded state
- Anchor positioning with a fallback position for other browsers
- @starting-style entry and allow-discrete exit animations
- Mark all as read through a checkbox and :has()
- Toasts anchored to the buttons that raised them
Accessibility
The bell is a button with popovertarget, which gives it an expanded state for assistive technology, and its name includes the unread count until everything is marked read. The panel is a region named by its heading, Esc closes it, and it follows the bell in the DOM so Tab moves straight into it. Toasts have role="status" and named close buttons; a screen reader may not announce a popover as it opens, so keep important messages in a live region too. Transitions are off under prefers-reduced-motion.
Customise it
Change --mc-brand, --mc-ink, --mc-text and --mc-line on .mc, the anchor names on .mc-bell, .mc-a-copy and .mc-a-watch, and the fallback position in the @supports not (anchor-name: --a) rule. Bootstrap restyles .card, .list-group and .toast through their variables; Tailwind uses arbitrary properties such as [anchor-name:--mc-bell] and the open: and starting: variants.






