Components

Share & Permissions Popover

A Notion-style share popover that is three views in one floating surface: the share list, a per-person role picker, and link settings. Each view declares its own natural width, so swapping panels morphs the popover on both axes - width and height are always a measured px easing between views (the height:auto illusion, twice), while panels slide directionally with a breadcrumb back header. The focus trap survives the swaps: Tab cycles the live panel only, pushing into the role picker lands focus on the current role, popping back returns it to the exact row that opened it, and closing hands it back to the Share button. Escape backs out one layer at a time. The popover scales in from under the trigger (origin-aware, never center) and stays mounted so open and close are interruptible. Tick Loose focus and Tab quietly walks out of the popover - the trap is the difference.

Q3 Launch PlanEdited 2h ago

Popover: closed · 4 people · Link: Invited people only

Install

npx moumenlab add share-permissions-popover

For AI

Open .md

Usage

"use client";

import SharePopover from "./share-permissions-popover";

// Seed it with your collaborators and wire onShare to persist every change
// (invite / role / remove / link scope).
export default function SharePopoverExample() {
  return (
    <SharePopover
      docTitle="Q3 Launch Plan"
      owner={{ name: "Moumen Soliman", email: "moumen@acme.co" }}
      people={[
        { id: "sarah", name: "Sarah Chen", email: "sarah@acme.co" },
        { id: "omar", name: "Omar Farouk", email: "omar@acme.co" },
        { id: "june", name: "June Park", email: "june@acme.co" },
      ]}
      initialRoles={{ sarah: "full", omar: "edit", june: "view" }}
      onShare={(event) => console.log(event.type, event.detail)}
    />
  );
}