shadcn.io is not affiliated with official shadcn/ui
Mobile Push Settings Block for React
A push settings panel that leads with a 24-hour strip of quiet hours, a critical-alerts switch, and per-device Push, Sound and Badge toggles with a save bar that counts unsaved changes.
Installation
Overview
Let people set when their phone may buzz and which devices it may buzz, with this mobile push settings panel for React with Base UI. Inside a hairline frame with a plus mark on each corner, the first band is a strip of the 24 hours of the day, one cell each, with the quiet window shaded and wrapping past midnight. Two Native Select menus set its start and end, the strip and the sentence under it follow at once ("Quiet 22:00 to 07:00, 9 hours a day"), and a Switch decides whether critical alerts break through. Below it a list of devices carries a Push, a Sound and a Badge Toggle for each one, with the date it was last seen; Sound and Badge wait on Push, and a count says how many devices get push at all. The last band counts unsaved changes in a status line beside a Shine Button to save them and an outline Button to discard them; both stay in place and focusable while there is nothing to do. On a phone the strip comes first, each device's three toggles become a row, and the save bar stays pinned to the bottom of the screen. It's built from Native Select, Switch, Toggle, Field, Button, Shine Button and Guides, with a CSS entrance only. For the push page of any app that has quiet hours, a smart home, a pager or a chat.
FAQ
How do I fill it with my own devices?
Edit the constants at the top. DEVICES lists each device with its name, its kind, whether it is a tablet and the ISO day it last reached your server; the dates are written in UTC, so they read the same in every time zone. SAVED is what the account has stored when the page opens: the quiet start and end as two-digit hours, whether critical alerts break through, and the toggles that are on, written as a device and a kind ("work:push"). The counts, the strip and the sentence are worked out from those, so nothing is typed twice.
How does the strip work, and what happens past midnight?
Each of the 24 cells is shaded when its hour falls inside the quiet window. When the start is later than the end, as in 22:00 to 07:00, the window wraps: the cells from the start to midnight and from midnight to the end are both shaded, and the sentence says how many hours that is. The shading is a tint with a bar under it, so it reads in light and dark themes and in every colour preset. The strip itself is drawn left to right in every language, since time on it runs one way, and it is named for a screen reader with the same sentence that is printed under it. If the start and the end are the same hour the strip has nothing shaded and the sentence asks for a different end.
What does Critical alerts always deliver do?
It decides whether a critical alert (smoke, a leak, a door opened while you are away) is held with the rest during quiet hours. On, the sentence says critical alerts still sound; off, it says they wait too. The block only keeps the choice and the wording: to make it real, send the flag with the quiet window to your push service and mark critical notifications with your platform's critical or time-sensitive level, which is what lets them through a phone's own do-not-disturb setting.
What happens when I press Save, and what stays local?
Nothing leaves the page. The block keeps two copies of the settings, the saved one and the one being edited, and counts how many settings differ, so the status line can say "3 changes not saved yet." Save makes the edited copy the saved one and says it was saved in this demo; Discard puts the saved copy back. To make it real, send the edited copy to your API in the save handler and update the saved copy from the response, showing the error in the same status line if it fails. Save and Discard are marked aria-disabled rather than disabled while nothing changed, so they keep their place and focus; pressing one then says there is nothing to do.
Why are Sound and Badge disabled for a device?
They only mean something while that device receives push, so turning its Push toggle off disables the other two and shows them off. The choices you made for them are kept, so turning Push back on brings them back as they were, and unsaved changes are counted from what you actually set. Each toggle's name for a screen reader includes the device ("Sound for Work phone"), since three devices share the same visible words.
How does it look on a phone?
Below the medium breakpoint the strip and its sentence come first and the hour menus and the critical switch follow under them, then the devices. Each device's name and last-seen date sit over a row of three equal toggles, and the save bar sticks to the bottom of the screen while you scroll, then settles at the panel's foot. At 320 pixels the strip's hour labels keep their place, the cells shrink and nothing scrolls sideways.
Related
- Pro
Notification Preferences Settings
NotificationsA notification settings panel: a channel strip with all-or-nothing checkboxes, a matrix of switches by activity and channel with a locked security email, quiet hours, and a save bar that counts unsaved changes.
- Pro
Usage Alerts Billing
Plan and usageUsage alert settings: percentage thresholds as switches with number inputs, recipients as email chips, and a choice between email and a webhook, with a save that checks them.
- Pro
Toggle Switch Control Panel Features
Live controlsA notification matrix for an alerting product: five events by four channels, every cell a working Switch, a counter that rolls as you flip them and a footer that offers Save and Discard in reserved space.
- Pro
A setting callout for an uptime monitor: a card in card with a bell icon, a heading and a sentence, and an Off or On label beside a switch that rewrites the sentence and lights a status dot.
- Pro
Notification Bell Changelog
Votes and sharingA release feed with a bell: an unread count in a chip, the latest three releases as rows with unread markers, and a popover that marks them read and holds Email and Push switches.
- Pro
Auto Replies Settings
NotificationsA vacation responder settings panel that leads with the sentence the settings amount to, a form with a subject, a message with variable chips, two date fields and a once-per-sender rule, beside a framed drawn email filled from a sample sender.