Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Share Permissions Dialog Block for React

A team drive with its share dialog shown open: a name or email field with suggestions under it, a role select and a Remove for each person added, a fixed owner, two inherited rows with a lock, and a general access select, with the people count said whenever it changes.

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

Let people add one collaborator at a time and see exactly what each one can do, with this share permissions dialog for React with Base UI. It opens from a file in the Q4 plans folder of Lockerbrook, a team drive: the page's header holds an outline Share Button, and the folder, its avatar stack and count as text and a column of file rows, is drawn under a soft scrim inside a hairline frame with a plus mark on each corner. The Dialog has an Input for a name or an email with its suggestions inline under it in a Listbox: typing swaps the list of people for the matches, Arrow Down moves into them, Enter takes the first, and a full address nobody knows becomes an invite by email. Each person added is a row with initials, a role Native Select (Viewer, Commenter, Editor) and a Remove; the owner is fixed, two people who inherit access from the folder sit under a lock with no controls, and a general access select chooses restricted or anyone at Lockerbrook. A line counts how many people have access. Done is the only Shine Button and keeps the list on the drawn drive. For preview the dialog is drawn open in place when the page loads; the header button opens the real dialog, with the same list. For drives, wikis, boards and any app that shares a file with named people.

FAQ

Why is the dialog already open, and what do I keep?

So you can see it without a click. On load the dialog is a copy drawn in place over the drive: a native dialog element that isn't modal, so nothing is trapped, hidden or focused, and the page around the preview keeps working. The Share button opens the real Dialog, modal, with its focus trap, Escape and focus return, and the copy stays closed until a reload. Both show the same PeopleFields component and share the block's state, so someone added in the copy is in the real one. In your app keep the Dialog and drop the copy: the "in-place" state, the scrim and the dialog element inside the frame.

Why is the suggestion list inline and not a popup?

Because a popup opened from inside a modal fights the modal. A combobox's list is portalled out of the dialog, so on some libraries the dialog counts a click on it as outside and closes, and React Aria makes it inert. Here the suggestions are a Listbox in the same box as the people list: while the field has text the box shows the matches, and when it is empty it shows who has access, so the dialog never changes height. Arrow Down in the field moves into the list, the arrow keys move through it, Enter picks, and Enter in the field takes the top match.

What are the inherited rows?

People who have access to the file only because they have access to the folder. They are shown so the count is true, with a lock and their role, and they have no select and no Remove: changing them is a job for the folder's own sharing. The owner row is fixed the same way. The line above the list counts the owner, the inherited people and everyone you added, and says the new count after each add, change or removal.

Is it accessible from the keyboard?

Yes. The real dialog is named by its title and described by its sentence, focus starts on the add field, and Escape, Cancel and the close button return focus to the Share button. The people list is a keyboard-reachable scroll region, every role select and Remove has the person's name in its label, and what changes is spoken once in a polite status line (inside the dialog while it is open). The trigger is passed to DialogTrigger through render, and the dialog is controlled with open and onOpenChange.

What stays local, and how do I wire it for real?

Everything. Nobody is invited and nothing is shared: the directory of eight people, the owner and the inherited rows are typed in the file, an address typed into the field only becomes a row in this block's state, and Done writes the list to the drawn drive. In your app search your directory on the server as the person types, send the invite from your API, check the role on every request, and read the inherited people from the folder's own permissions.

How does it look on a phone?

The copy shown on load docks to the foot of the page as a bottom sheet with its buttons pinned and the content scrolling above them, the add field first. Each person's row gets a second line for the role select so a name is never cut. The real dialog keeps the Dialog's own phone layout, a sheet stuck to the bottom of the screen.

  • Pro

    Team Roles Dialog

    Share and invite

    A members page with its roles dialog shown open: seven members with a select-all that shows all, none or a dash, a role select with a line about each role, a Can and Cannot list that changes with it, and a guard that refuses to leave the workspace without an Owner.

  • Pro

    Share Link Dialog

    Share and invite

    A prototype file with a share dialog shown open: a switch for anyone with the link, a read-only link whose role and expiry show in its suffix, a Copy link button that really copies, and a viewer preview that turns the file behind the dialog read-only.

  • Pro

    Invite Members Dialog

    Share and invite

    A household calendar's Members page with its invite dialog shown open: one email field that knows the household's domain, so an outside address joins as a guest, the people who already have access, and a Send invite button that adds a pending row.

  • Pro

    Invite Team Dialog

    Share and invite

    A crew page with its bulk invite dialog shown open: a pasted list becomes one chip per address with bad ones flagged, one role for the batch, a seat meter that refuses a batch that does not fit, and a Pending tab with Resend, Revoke and Undo.

  • Pro

    A document tool's share dialog shown open over a drawn page: three access cards beside a padlock that is shut, ajar or open, a people field with a pick list of five teammates, avatar chips, and a Share with 2 people button.

  • Pro

    The people who can sign in to a shared account as hairline tiles: role menu, two-factor on or off, last sign-in, those without two-factor first with a reminder button, pending invitations and an invite form.