Share dialog

A React component in Beamline's Overlays category, in the free sample.

Share a document, board or project: invite people by name or email with the access they get, change or remove anyone's access in place, and set who the link opens for, with Copy link; inviting turns the dialog into the invitation (role, notify, a note) and back.

Use it for

  • Sharing one thing (a document, a dashboard, a project, a report) with people and deciding what each may do.
  • The share panel inside a popover or a sheet beside the thing being shared (SharePanel).

Not for

Anatomy

  • ShareDialog: the system Dialog (title “Share ‘…’”, its trigger) around a SharePanel; the dialog eases to each step's height
  • invite field: people already chosen as chips, typing finds people in your directory (name, email, team) or takes any valid email; Backspace takes back the last chip
  • people with access: avatar, name (and You), email, a Pending tag for invitations not yet accepted, and the access each has as a menu (roles, then Remove access); the owner's row says Owner and has no menu
  • a removal leaves a line in the person's place, “… no longer has access · Undo”, for a few seconds
  • general access: an icon that turns with the setting (lock, building, globe), who the link opens for, and what they may do
  • footer: Copy link, and Done
  • invite step: the chips, the role they get, Notify people, a note, and Cancel / Send invite; a refusal says why and keeps the draft

Variants

  • linkAccess: restricted, organization, anyone

States

  • list (people with access, general access)
  • inviting (chips chosen: role, notify, note)
  • sending (Send shows progress; the field and choices hold)
  • sent (the new people grow into the list as Pending, and a line says who was invited)
  • refused (the reason under the field; the draft stays)
  • changing a role (the menu's choice applies at once; a refusal puts it back and says why on the row)
  • removed (an Undo line in the person's place)
  • outside the organisation (an email from another domain is marked Outside and said in words)
  • read-only (canManage false: every access is shown, nothing can be changed)

Keyboard

  • Focus starts in the invite field; ↑/↓ move through matches, Enter or Tab adds the active person, Enter on a typed email adds it, comma adds it too
  • Backspace in an empty field selects the last chip, a second Backspace removes it
  • Tab reaches each person's access menu (↑/↓ inside, Enter chooses) and the general access controls
  • Escape closes the match list first, then the dialog; in the invite step Escape goes back to the list step
  • Enter in the note does not send; ⌘/Ctrl+Enter sends

Motion

The dialog opens out of its trigger and eases to the invite step's height and back (Dialog step). Chosen people grow in as chips; the match list opens out of the field with a plate gliding between rows. Invited people grow into the list and the rest slide down (useFlip); a removed person's row gives way to its Undo line in place. The general access icon turns into its next shape (lock → building → globe) as the setting changes. Reduced motion keeps the fades and places everything at once.

Props

PropTypeDefaultDescription
titleReactNode—The thing being shared, as the dialog's title.
triggerReactElement—What opens it, usually a Share button.
open / defaultOpen / onOpenChangeboolean—open: Controlled open state; omit to use defaultOpen. defaultOpen: Initial open state when uncontrolled; defaults to false. onOpenChange: Reports an open-state change; no callback by default.
people (required)ShareMember[]—{ id, name, email, src?, role, owner?, you?, pending? }.
directorySharePerson[]—People who can be found by typing: { id, name, email, src?, team? }.
roles{ value, label, description? }[]—Default Can view, Can comment, Can edit.
defaultRolestring—The role new invitees get. Default the first role that is not the most powerful (Can comment), else the first.
organization{ name: string; domain: string }—Names the organisation option of the link and marks invitees from other domains as Outside.
onInvite(invite: { people: SharePerson[]; role: string; notify: boolean; message: string }) => void | Promise—A promise shows progress; a rejection keeps the draft and shows its message.
onRoleChange(member: ShareMember, role: string) => void | Promise—A rejection puts the old role back and says why on the row.
onRemove(member: ShareMember) => void | Promise—
onRestore(member: ShareMember) => void—Offers Undo after a removal.
linkstring—The address Copy link copies; without it there is no general access section.
linkAccess / defaultLinkAccess / onLinkAccessChange"restricted" | "organization" | "anyone"—
linkRole / defaultLinkRole / onLinkRoleChangestring—What people who open the link may do.
canManageboolean—False shows who has access without any controls.
className / classNames / style / refSharePanel root—className: Classes on the documented visual root; no override by default. classNames: Classes for the named visual parts; no overrides by default. style: Inline styles on the documented visual root; no overrides by default. ref: Receives the documented native target or imperative handle; omitted by default.
openboolean—Controlled open state; omit to use defaultOpen.
defaultOpenboolean—Initial open state when uncontrolled; defaults to false.
onOpenChange((open: boolean) => void)—Reports an open-state change; no callback by default.
refRef<HTMLDivElement>—Receives the documented native target or imperative handle; omitted by default.
styleCSSProperties—Inline styles on the documented visual root; no overrides by default.
classNamestring—Classes on the documented visual root; no override by default.
classNamesPartial<Record<"root" | "footer" | "role" | "status" | "error" | "removed" | "person" |…—Classes for the named visual parts; no overrides by default.
linkAccessShareLinkAccess—
defaultLinkAccessShareLinkAccess—
onLinkAccessChange((access: ShareLinkAccess) => void)—
linkRolestring—
defaultLinkRolestring—
onLinkRoleChange((role: string) => void)—
SharePanel.doneReactNode—On SharePanel: Inside ShareDialog: what ends the panel (Done).
SharePanel.onStepChange((step: "list" | "invite") => void)—

Built from

Used in

Dependencies

@radix-ui/react-dialog, @radix-ui/react-popover, lucide-react

Import

import { SharePanel, ShareDialog, SHARE_ROLES } from "@beamline/share-dialog";

Get it

Share dialog is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Share dialog is included in the free MIT sample. Get Beamline · Connect your agent

More in Overlays

  • Command menu: Search-first list of every action: ranked matching, groups, keycap shortcuts and nested pages; inline as CommandPalette or in a ⌘K dialog as CommandMenu.
  • Toast: Short results of an action stacked at an edge: point at the stack to fan it out and pause the timers; undo or retry in place; Alt+T, Escape and a swipe…
  • Context menu: Actions for an object on right-click, long-press, Shift+F10 or the menu key, opened at the pointer, with the same rows as the dropdown menu.
  • Hover card: A preview of a person, link or record on hover or keyboard focus, without leaving the page; HoverCardProfile is the standard person preview.
  • Product tour: A short guided tour over the real interface: a spotlight that glides from one element to the next while the rest of the screen dims, and a card beside…
  • Bottom sheet: A phone panel that rests at a peek and follows the finger to full height; a flick down closes it, and the handle works from the keyboard.
  • Sheet: A panel that slides in from an edge with the page still visible behind it: header and footer stay put while the body scrolls.
  • Dropdown menu: A list of actions behind a trigger, with shortcuts, check items, headings and submenus; one highlight glides under the pointer and jumps with the keyboard.
  • Dialog: A focused task over the page (create, invite, rename) with a title, body and footer; focus moves in, is trapped and returns on close.
  • Alert Dialog: A blocking confirmation that must be answered: the scrim does not dismiss it, focus starts on the safe choice, and an async action keeps it open until…
  • Popover: A small surface anchored to a trigger for a short form, a filter or an explanation; focus moves in and returns on close.
  • Tooltip: Short supporting text for a control: opens after a moment on hover and at once on keyboard focus; inside a toolbar group the next one opens instantly.

Part of Beamline UI: polished, editable React components and complete screens for custom applications. Build your own style from any look; tokens, fonts, radii, motion; not only colours.