shadcn.io is not affiliated with official shadcn/ui
Notification Preferences Settings Block for React
A 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.
Installation
Overview
Let people choose what they hear about and where, with this notification settings panel for React with Base UI. A compact header holds the title and a Native Select of presets (Recommended, Everything, Only what needs me, In-app only) that fills the matrix and reads Custom once you change a cell. Inside a hairline frame with a plus mark on each corner, a strip names the four channels, says where each one reaches you and how many activities use it, and gives each a Checkbox that turns it on or off everywhere, mixed while only some are on. Below it a native table crosses five activities with the four channels, every cell a Switch named for both; the security email is locked on and the weekly digest isn't offered by SMS. A quiet-hours band holds push and SMS between two hours you pick, and says what that amounts to. 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's nothing to do. On a phone each activity becomes a card with four Toggle chips, and the save bar stays pinned to the bottom of the screen. It's built from Checkbox, Switch, Toggle, Native Select, Field, Button, Shine Button and Guides, with a CSS entrance only. For the notification page of any app, a workspace's defaults or an onboarding step.
FAQ
How do I fill it with my own activities and channels?
Edit the constants at the top. CHANNELS lists each channel with its label and where it reaches the person (an address or a phone number keeps its own order in any language, so it's marked ltr). ACTIVITIES lists each kind of notice with a one-line hint, the channels it can go to (offered) and the ones that can't be turned off (locked). PRESETS are named sets of cells, and SAVED is what the account has stored when the page opens: put the person's real settings there. Every count, the channel checkboxes and the preset's name are worked out from those, so nothing is typed twice.
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 (or only what changed) 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's nothing to do.
How do the channel checkboxes and the locked cell work?
Each channel's checkbox looks at the cells of that channel you can switch: ticked when all are on, empty when none are, and mixed in between. Ticking it turns the channel on for every activity; ticking it again when it's all on turns it off. The security email is locked on: its switch is shown on and disabled with a lock beside it, the activity's hint says why, and no checkbox, preset or chip can turn it off. A channel an activity doesn't use (the digest by SMS) shows a dash, read out as "Not offered", and its phone chip is disabled.
What does the quiet-hours band check?
It holds push and SMS between the two hours, wrapping past midnight, and the sentence under it says how long that is ("Push and SMS wait from 22:00 to 08:00, 10 hours a night"). Turned off, the hour menus stay in place but disabled, so nothing moves. If the start and the end are the same hour the sentence says so with an alert icon, and Save refuses with a reason and moves focus to the end time. Times are whole hours in the person's own time zone; store the zone with the settings.
How does it look on a phone?
Below the medium breakpoint the channel strip becomes two by two and the table becomes one card per activity, its name and hint over four toggle chips labelled Email, Push, In-app and SMS, solid when on. A chip's name for a screen reader includes the activity ("Email for Mentions"). The save bar sticks to the bottom of the screen while you scroll the panel, so Save is always in reach, and settles at the panel's foot when you get there; from the medium breakpoint it's simply the last band.
Is the matrix accessible?
It's a native table with a caption, column headers for the channels and a row header for each activity, so a screen reader announces both as you move between cells, and every switch is also named for both ("Push for Status changes"). The channel checkboxes are named by the channel and described by their count and destination, and the status line is a polite live region that's present from the start. Every control that can change is reachable with Tab and works from the keyboard; the locked switch is skipped, and its row says why. On Base UI the mixed state is the checkbox's indeterminate prop.
Related
- 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
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
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
Reading Preferences Blog
Reading toolsReader preferences with a live preview: a Slider for text size, a ToggleGroup for serif or sans, a Select for line spacing and a Switch for justified text, with a framed sample article that follows every control and a Reset button.
- 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.