Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Permission Request Notification Block for React

A travel journal's permission list: camera, location and microphone, each with what it is for, a state badge, a segmented Allow, Allow once or Deny, a line on what the choice means, Allow all requested and Reset.

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

Ask for several permissions on one screen and say what each one is for, with this permission list for React with Base UI. A compact header, which says the choices are drawn, sits over one hairline frame with a plus mark on each corner. A band names the requests and counts how many are decided ("2 of 3 decided"). Under it a row for each of camera, location and microphone: a tile, the name, a state Badge (a shape and a word: Not asked, Allowed, Allowed once or Denied), the reason the app asks, a line on what the choice means for the app, and a Segment Group of Allow, Allow once and Deny. The last band says what the choices add up to ("1 allowed, 1 allowed once, 1 denied") beside a Shine Button to allow all three and a Button to reset them. The choices are drawn: nothing here asks your device for a permission. It's built from Segment Group, Badge, Shine Button, Button and Guides, with a CSS entrance only. For an onboarding step, a first-run screen or a settings page that explains what an app needs before it asks.

FAQ

How do I change the requests?

Edit REQUESTS at the top of the file. Each has an id, a name, what it is needed for (why) and four short lines the row can show: what the app says before it asks (asked) and what it says after Allow, Allow once and Deny. The icon comes from the id, the badge and the counts come from the choices, and the summary is worked out from them, so adding a fourth request is one more entry.

Does anything ask my device, and what stays local?

No. Choosing Allow, Allow once or Deny only changes this page, and the line in the foot says "Nothing is asked of your device in this demo" until something is chosen. In your app, ask for a permission when the person reaches the feature that needs it (the browser's own prompt appears then), read the answer and put it in the same state: the camera, location and microphone prompts each have their own API, and none of them can be asked again once denied.

What does Allow once mean here?

Allowed for this visit only: its badge says so, and its line says the app will ask again next time. Browsers differ in whether they offer this choice, so check what yours does before you promise it; the demo keeps it because many apps say it in their own words.

What do Allow all requested and Reset do?

Allow all requested sets every row to Allow and says so. Pressing it when all three are already allowed answers "All three are already allowed" and changes nothing. Reset puts every row back to Not asked, and says "Nothing to reset" when nothing was decided. Both stay in place and focusable at all times.

Is it accessible?

Each row's choice is a group named for its permission ("Camera permission") whose three options work with the arrow keys, and the state is a word as well as a shape, so colour never carries it. The line on what the choice means keeps its height, so choosing never moves the next row. The status line is a polite live region that is present from the start and reads the summary after each change.

How does it look on a phone?

Each row stacks: the tile, name and badge on one line, the reason and the consequence under them, and the three options across the full width. The foot stacks its status over the two buttons, the primary taking the width.

  • Pro

    A news app's push permission ask drawn in a browser window: a soft card on the page, a drawn browser prompt with Allow and Block, and the three outcomes, with a line that says nothing is asked of your real browser.

  • Pro

    Camera Denied Error

    Browser and device

    A 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 device

    A 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

    An uptime monitor's status page with a dialog shown open that asks before the browser does: three switches with an example each, a live preview of drawn notification cards, a not-now path and a Don't ask again box, and no browser prompt.

  • Pro

    Permissions Account

    Shared access

    A read-only matrix of what each role may do: permissions in four folding groups against four roles with counts, your own role framed and marked You, and a Request button on what it lacks.

  • Pro

    A news site's corner cookie card: Reject all and Accept all as equal buttons, a Customize that opens a switch for each optional kind with the cookies it sets, and a one-line receipt you can change.