Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Mark All Read With Undo Notification Block for React

A summary band with a rolling unread count and a mark all read that fades the dots in turn and offers an exact undo, over a list where every row can be marked unread again.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Make clearing an inbox feel immediate and safe, with this mark-all-read panel for React with Base UI. A summary band sits over the list in two cells with a shared hairline: the unread count in a Sliding Number with the number of channels it comes from, and a Mark all read Button. Pressing it rolls the count to zero while the unread dots fade out one after another, and the button cell becomes a strip that says how many were marked read, with an Undo that puts back exactly the messages that were unread. Below, six messages each carry a Toggle to mark one unread again. Unread is a dot, a heavier name and the word Unread for a screen reader. A Clear all button empties the list into an Empty state in the same height, with a Restore. It's built from Sliding Number, Toggle, Button, Empty and Guides, with CSS for the fade. For a team chat, a messages page or any list with a mark-all action.

FAQ

How do I fill it with my own messages?

Edit MESSAGES. Each has an id, who sent it (who and its initials), the channel, the text, an ISO at time and whether it starts unread. The count, the "In 3 channels" line and the toggles' states are worked out from the list of unread ids, so nothing is typed twice. Times are written in UTC and shown against AS_OF, so the page reads the same everywhere.

How exact is the Undo?

Mark all read keeps the list of ids that were unread and then clears it; Undo puts that list back, so the same messages are unread again, including ones you had marked unread by hand before. The Undo strip goes away as soon as you change one row by hand, because after that putting the old list back would no longer be exact. Focus moves to Undo when the button goes away and back to Mark all read when Undo is used.

What stays local, and how do I make it real?

Read state lives in the page and resets on reload; nothing is sent. To make it real, send the ids that Mark all read changes and the id of a single toggle, and let Undo send the same list back. The strip is a good place to show a failed request: swap its text for the error and keep Undo as Retry.

What moves, and what happens with reduced motion?

The count rolls like an odometer and each dot fades, with a delay that grows by row so they go out in turn. Both are CSS only. With reduced motion the digits change in place and the dots change at once, with no delay. Nothing else animates, and the list's height never changes: the strip takes the place of the button.

Is it accessible?

The count is read out as a plain number, and the status line, a polite live region present from the start, says what each action did. Every toggle is named for its message and says whether it is pressed, and an unread name is spoken first with the word Unread. The button stays focusable when nothing is unread and answers "Nothing is unread".

How does it look on a phone?

The two summary cells stack, the Mark all read button fills the width, and the time column is dropped so each row keeps its name, its message and its toggle. The list stays six rows tall, with or without messages.

  • Pro

    An inbox with an unread-only switch and a live count, where a row you read stays in place until you turn the switch off, and zero unread is a designed Inbox zero state.

  • Pro

    A notification centre as a narrow panel: tabs for All, Mentions and Alerts with their own unread counts, rows you press to mark read, a mark all read for the open tab and a clear with an undo.

  • Pro

    Notifications grouped into Messages, Updates and Alerts in an accordion, each group with an unread count, its own mark read beside the trigger, a one-line summary when folded, and collapse and clear for the whole list.

  • Pro

    A UI kit's count badge drawn on three header buttons: a number field sets the bell, a toggle switches number and dot, and each cell prints what is shown and what a screen reader hears.

  • Pro

    An unread-messages bar for a team messaging app: a dot, a rolling count, a link to the inbox and a Mark all read button that rolls the count to zero.

  • Pro

    Notifications split into Pinned and Recent with a pin on every row and a limit of three: the pinned ones stay on top in the order you pinned them, and at three the other pins say to unpin one first.