Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Delegate Access Account Block for React

Temporary access to an account: a list of active grants with how far through each is and when it ends, End now with Undo, and a side sheet that picks a person, what they can do and 1 to 90 days.

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 lend part of their account for a set time, with this temporary access panel for React with Base UI. A hairline frame with a plus mark on each corner holds a ruled list of active grants, the one ending soonest first: an initials Avatar, the person and what they can do, the day and hour the access ends (always 23:59 UTC on the last day), a thin bar and "20 days left", and an End now button. The header's Shine Button is the only colored control: it opens a Sheet from the end side with a form in three steps. Pick one of four contacts as a row of native radios, tick what they can do in a group of Checkboxes, and move a Slider from 1 to 90 days while the end is written out beneath it. Granting adds a row (or replaces that person's grant), ending removes it and a line at the foot says what happened, with Undo bringing the last change back. When no grant is left an Empty state fills the space and the panel keeps its height. It's built from Sheet, Slider, Checkbox, Avatar, Empty, Button, Shine Button and Guides, with a CSS entrance only. For the security page of any app where someone, an accountant or an auditor, needs to look in for a while.

FAQ

How do I fill it with my grants?

Edit GRANTS. Each has the contact it belongs to (an id from CONTACTS), the first day as an ISO from, a number of days, and the scopes it holds from SCOPES. The end day, the "20 days left" count and the bar are worked out from from, days and the one AS_OF constant, never the clock, so replace AS_OF with today's date when you wire it up. Access ends at the last minute of the last day in UTC, and the copy says so.

What stays local, and how do I make it real?

Everything. Granting, replacing and ending change this page's state and say so in the foot; nothing is sent and nobody gains access. To make it real, post the grant in grant and end, change the list only when your server answers, and let your server remove a grant when its end passes: the panel only draws it. Undo exists so the demo is easy to explore; a real one might offer to grant again instead.

How does the sheet work?

The button opens a real side sheet with a focus trap, Escape to close it and focus back on the button. It slides in from the end side whichever way the page reads. Cancel, Escape or the close button leave without changing anything; Grant access adds the row, closes the sheet and moves focus to that row's End now button. Picking a person who already has access warns "Has access until 3 Nov, and this replaces it". Granting with nothing ticked says so under the boxes and moves focus to the first one.

How does the number of days work?

The slider runs from 1 to 90 days in one-day steps, and the arrow keys move it by a day. Its name is "Days of access" and its value is read out as "14 days". Under it, the end is written from the as-of day ("Ends 28 Oct, 23:59 UTC") so the person sees the real last day, not only a count. A new grant counts its first day as the as-of day.

What does End now do?

It removes that grant at once, with no dialog, because it only takes access away and Undo is always in the foot. Focus moves to the next row's End now button, or to Undo when it was the last grant. The list keeps its height as grants leave, and an empty list shows a message in its own space.

How does it look on a phone, and is it accessible?

Each grant is a card: the person and the End now button first, then the end and the bar under them. The sheet is full width and its form scrolls while Cancel and Grant access stay at the foot; the foot of the panel with the status and Undo stays pinned. The list is a real list with named buttons ("End Dario Quist's access now"), the contacts are native radios in a group, the end day is a time element, and the bar is decoration beside the same fact in words. The status line is a polite live region present from the start.

  • Pro

    The people who can act on an account as a matrix: a row for each delegate with a box for each of four scopes, pending invitations with Resend, an invitation form whose role ticks the scopes, and Undo.

  • 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

    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.

  • Pro

    OAuth grants as a table: each app with its access level, grant date and last use, unused apps pinned to the top, scopes in plain words, a Revoke that can be undone and a bulk revoke that asks first.

  • Pro

    A role change from Viewer to Editor with who made it and when, the change as a You can now and a You can no longer cell with plus and minus marks and words, two tabs of facts and abilities at one height, and a local acknowledgement with Undo.

  • Pro

    One person an account may tell if its owner stops signing in: a replaceable contact, a slider of the inactivity period by stops with the consequence written with real dates, what they may ask for and what they can never do.