shadcn.io is not affiliated with official shadcn/ui
Snooze Notification Block for React
A notification with a snooze popover: Later today, Tomorrow and Next week worked out from one fixed time, a custom hour, a Snoozed list with wake times and a Wake now that sends one back.
Installation
Overview
Let people deal with a notification later without losing it, with this snooze for React with Base UI. A compact header holds the title and one sentence over a hairline frame with a plus mark on each corner. The first band holds the notification that is waiting, with its title, what it says, when it arrived and a Snooze Button that opens a Popover: Later today, Tomorrow and Next week, each with its weekday and hour, and a custom hour tomorrow in a Native Select. Every time is worked out from the page's fixed "now" by one pair of helpers, so the choices read the same everywhere. Choosing one moves the notification into the second band, "Snoozed (3)", under its wake time ("Wakes Thu 15 Oct, 09:00"), and the next one steps up; Wake now sends any snoozed one back to the front. When nothing is waiting a designed Empty state fills the same space, and each band keeps one height. It's built from Popover, Native Select, Button, Empty and Guides, with a CSS entrance only. For a read-later list, a task inbox or any inbox where "not now" is an answer.
FAQ
How are the snooze times worked out?
PRESETS is built from AS_OF by atHour and addDays: Later today is 17:00 on the same day (and is left out once that has passed), Tomorrow is 09:00 the next day, and Next week is 09:00 on the coming Monday. The custom choice is tomorrow at the hour you pick. All of it is in UTC, so the server and every visitor's time zone agree; to use the visitor's own zone, build the three dates from their local time in your app.
How do I fill it with my own notifications?
Edit ITEMS at the top of the file: each has an id, a kind (read or task, which picks the icon), a title, a body and an ISO at time. START_WAITING lists the ids that wait in order when the page opens, and START_SNOOZED the ones that are already snoozed, with their wake times. Counts in the two headings and the status line come from those lists.
What stays local, and how do I make it real?
Snoozing and waking live in the page and reset on reload; nothing is scheduled and nothing wakes by itself. To make it real, send the id and the wake time from snooze to your server, which brings the notification back when that moment arrives, and send the id from wake to bring it back early. The status line says "Preview only: nothing is scheduled." until you press something.
Where does focus go?
The Snooze button opens the popover and Escape closes it with focus back on the button. After you choose a time the popover closes and focus stays on the button, which now belongs to the next notification. After the last snooze the button is gone, so focus moves to the empty state; after Wake now it moves to the title of the notification that stepped up, and a polite status line says what happened.
Is it accessible?
Each Snooze and Wake now button says which notification it acts on ("Snooze Send the signed lease to Ines"). The popover is named "Snooze until", every choice is a button with its time in text, and the custom hour is a real labelled select that works with the keyboard and a screen reader. The two bands are headed with their counts, and the wake time is a time element.
How does it look on a phone?
The popover is the width of the screen minus a margin, so its choices are large touch targets. In the first band the Snooze button goes under the text and fills the width. Each snoozed row keeps a fixed height with a title and a wake line, and the list scrolls inside its box, so snoozing never changes the height of the panel.
Related
- Pro
Pin Limit List Notification
Sort and findNotifications 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.
- 421Pro
Tabbed Inbox Notification
Bells and panelsA 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
Unread Only List Notification
Unread and countsAn 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.
- 4Pro
Mark All Read With Undo Notification
Unread and countsA 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.
- Pro
Do Not Disturb Notification
Quiet and digestsA focus app's do-not-disturb panel: a status card that says in a sentence what the settings amount to, a 24-hour strip of the muted hours, one hour, until tomorrow or a nightly schedule, and the calls that still get through.
- Pro
A meeting about to start in a scheduling app: a catalog Timer counting down to it with a Pause, the agenda with start times, who is coming with an RSVP, Join call, Snooze 5 minutes and a real calendar file to download.