shadcn.io is not affiliated with official shadcn/ui
Notification Denied Error Block for React
A panel for blocked push notifications: two channel cells, Push (its state and the one-line fix, read from the browser) and Email instead, plus what the digest brings.
Installation
Overview
Offer another way when push notifications are blocked, with this notification denied panel for React with Base UI. It's the panel Briefwell, a news digest, shows: a heading and one sentence over one framed panel with a plus mark on each corner, and a Switch at the header's end that is a demo control, "Pretend push is blocked", on when the page opens. The first band is two channel cells on shared hairlines. Push shows its state as an outline Badge with a shape and a word, the one-line fix for that state, and "Your browser says: denied", read from the browser's notification permission and never requested. Email instead is a Field with an Input and the Shine Button "Email me instead", which checks the address, waits a moment and says it is saved in this demo with a way to change it. A second band lists what the digest brings, three typed kinds. The cells stack on a phone. For news, alerts, reminders and any app that offers push.
FAQ
What is real here, and what stays in the page?
The permission line is a real read of Notification.permission after the page loads, and the page never calls Notification.requestPermission. The email address is kept in the page's own state and nothing is sent; "Saved in this demo" says so. In your app, post the address to your mailing service on submit, and ask for push permission only from a button the visitor presses, never on load.
What does the Pretend push is blocked switch do?
It is a demo control and it is on when the page opens, so the blocked state is what you see whatever your browser says. Turn it off and the Push cell shows your browser's own answer: Blocked, Allowed, Not asked (the value default) or Unavailable, each with its own fix line, all held in one cell so nothing moves.
What are the four states of the Push cell?
Blocked (the visitor said no, so the fix is in the browser's site settings), Allowed (nothing to fix), Not asked (the browser has never been asked, and a real page asks from a button) and Unavailable (the browser has no notification support, which some phones' browsers don't). Each has a different shape in the badge, so colour never carries it.
How does the email form check the address?
When you press the button, not while you type. An empty field says "Enter your email address." and a malformed one says "Enter a full email address.", under the field, with focus on it. A good address shows a busy button for under a second and then the saved result in the same space, with a Change address button that returns to the field.
Related
- Pro
Camera Denied Error
Browser and deviceA full-screen page for a blocked camera and microphone: what the app can use, a Check again that reads the permission state, a drawn address bar with its popover, and the steps for three browsers in tabs.
- Pro
Location Denied Error
Browser and deviceA full-screen page for blocked location: type a town instead, nine towns filtered as you type, three stores and their distances beside a drawn map, and a Check again that reads the permission state.
- Pro
Clipboard Denied Error
Browser and deviceA panel for when the browser blocks copying: a read-only box that selects itself, Select all text, a Copy button that really tries the clipboard, the keys as words for Mac or Windows, and steps to allow it.
- Pro
Role Ladder Permission Denied Error
Locked and removedA full-screen permission page for a design-system manager: a role ladder of four rising steps with you at Viewer and Admin marked as needed, 'Two roles up' in words, and a Request access dialog that records a note and an owner in local state.
- Pro
Cookies Disabled Error
Browser and deviceA full-screen page for a browser with cookies off: a check that reads the browser and writes nothing, what four essential cookies hold, and the steps for three browsers in an accordion.
- Pro
Browser Unsupported Error
Browser and deviceA full-screen update-your-browser page with five real feature checks in a table (ES modules, CSS grid, :has(), WebGL, structuredClone), a Switch to pretend, and the browsers that have all five.