npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-invite-dialog.json --yesInvite dialog
ProSend an invite to people by their email addresses, with a role and an optional note, for React and Tailwind CSS. Part of Goop Pro.
What an agent sees
import { Button } from '@/components/ui/goop/button';
import { CopyButton } from '@/components/ui/goop/copy-button';
import { toast } from '@/components/ui/goop/toast';
import { InviteDialog } from '@/components/goop/patterns/invite-dialog';
function InvitePeople({ invite }: { invite: (emails: readonly string[], role: string) => Promise<void> }) {
return (
<InviteDialog
trigger={<Button>Invite</Button>}
heading="Invite to Fieldwork"
description="They get an email with a link to join the workspace."
roles={[
{ value: 'admin', label: 'Admin', description: 'Can invite people and change their roles' },
{ value: 'member', label: 'Member', description: 'Can see and change every study' },
]}
defaultRole="member"
inviteLink={<CopyButton value="https://fieldwork.example/join/7f3a9c" label="fieldwork.example/join/7f3a9c" />}
onSend={async (values) => {
await invite(values.emails, values.role);
toast(`${values.emails.length} invites sent`);
}}
/>
);
}Open "Invite people": the addresses take the focus. Type an address and press Enter or a comma, or paste a list (commas, semicolons, new lines, "Name <address>"); one that is no address is marked and named under the field, and Backspace twice removes the last tag. Pick a role (Enter opens its list, the arrows move), add a note, then ⌘ Enter or Send: the button is busy for a moment and the people join the pending list. An address invited already is refused in place. The line under the list says while the dialog is open and the addresses it holds. The send is a timer; nothing is emailed, and the invites live in the page only.
When to use
- Send an invite to people by their email addresses, with a role and an optional note.
- Use it for every "Invite" on a members page, a team's settings or a share menu: people are invited by address, so the dialog never asks for a name or a form of one field per person. Put the roles a person may join as in
roles, each with adescription; giveinviteLinkthe link's words, or the theme's ghost CopyButton labelled with them (<CopyButton value={url} label={url} />) so a press copies it, when the workspace has a link to share. InonSend, refuse an address already a member or invited by throwing an Error that names it: the dialog shows it and stays open. Say the invites went with a Toast after it closes.
When not to use
- For a new record use CreateDialog.
Installation
Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Invite dialog on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-invite-dialog.json --yesAdd the Goop Invite dialog to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { Button } from '@/components/ui/goop/button';
import { CopyButton } from '@/components/ui/goop/copy-button';
import { toast } from '@/components/ui/goop/toast';
import { InviteDialog } from '@/components/goop/patterns/invite-dialog';
function InvitePeople({ invite }: { invite: (emails: readonly string[], role: string) => Promise<void> }) {
return (
<InviteDialog
trigger={<Button>Invite</Button>}
heading="Invite to Fieldwork"
description="They get an email with a link to join the workspace."
roles={[
{ value: 'admin', label: 'Admin', description: 'Can invite people and change their roles' },
{ value: 'member', label: 'Member', description: 'Can see and change every study' },
]}
defaultRole="member"
inviteLink={<CopyButton value="https://fieldwork.example/join/7f3a9c" label="fieldwork.example/join/7f3a9c" />}
onSend={async (values) => {
await invite(values.emails, values.role);
toast(`${values.emails.length} invites sent`);
}}
/>
);
}- Fits: frame: sidebar-foot; settings: overlay.
- Also known as: InviteModal, InviteMembersDialog, InviteForm, ShareDialog.
- height, width, padding, gap, corner, background, shadow, text: add no class for these.
API reference
- Each option with its sentence: invite-dialog--options.md
- Takes every prop of DialogContent but children, title, variant, size, onOpenAutoFocus and defaultValue (its page: dialog.md)
- State: open (open / defaultOpen / onOpenChange); emails (emails / defaultEmails / onEmailsChange); drawn by data-focus-visible, data-state=open, data-disabled
- data-slot values (to select a part by): invite-dialog, invite-dialog-action, invite-dialog-error, invite-dialog-group, invite-dialog-header-action, invite-dialog-link, invite-dialog-trigger
InviteDialog: every option
import { InviteDialog } from '@/components/goop/patterns/invite-dialog';Options
- open?: boolean — Open, held by the caller; pair with
onOpenChange. - defaultOpen?: boolean = false — Open at first, when the dialog holds its own open state.
- onOpenChange?: (open: boolean) => void — Called as it opens and closes.
- modal?: boolean = true — The page held behind it while open;
falsefor a picture held open beside the page. - trigger?: ReactNode — The control that opens it (the theme's Button), wrapped as the dialog's trigger.
- heading?: ReactNode = 'Invite people' — The dialog's name, in its header.
- description?: ReactNode — One muted line, the first thing under the header, saying what happens next.
- emails?: readonly string[] — The addresses, held by the caller; pair with
onEmailsChange. - defaultEmails?: readonly string[] — The addresses at first, when the dialog holds them.
- onEmailsChange?: (emails: string[]) => void — Called with the addresses each time one is added or removed.
- roles?: readonly InviteDialogRole[] = [] — The roles a person may join as; none leaves the role's section out.
- defaultRole?: string — The role chosen as it opens and after each send; the first of
rolesby default. - defaultMessage?: string = '' — The note as it opens and after each send; empty when left out.
- isEmail?: (text: string) => boolean — Whether typed words are an email address; a plain
name@place.tldcheck by default. - invalidEmailsError?: (texts: readonly string[]) => string — The line naming the typed words that are no address.
- onSend?: (values: InviteDialogValues) => unknown — Sends the invites: a promise the dialog waits on; throw or reject to keep it open with the error.
- sendLabel?: (count: number) => string — The main button's words, by the count ("Send 3 invites" by default).
- inviteLink?: ReactNode — The band's start: the link's words, or the theme's ghost CopyButton labelled with them, in small muted mono; a control with an edge (an outline CopyButton labelled "Copy invite link") keeps its own words.
- emailsLabel?: string = 'Email addresses' — The addresses field's accessible name (no label is drawn: the field stands under the title).
- emailsPlaceholder?: string = 'name@example.com, name@example.org' — The addresses field's placeholder.
- roleLabel?: string = 'Role' — The role section's label, and its row's name; "Role" when left out.
- messageLabel?: string = 'Message' — The note section's label; "Message" when left out.
- messagePlaceholder?: string | null = 'Add a note to the invite (optional)' — The note's placeholder;
nullleaves the note out. - container?: HTMLElement | null — Where the layer and the role's list are portalled; the end of
<body>when left out. - Takes every prop of DialogContent but children, title, variant, size, onOpenAutoFocus and defaultValue (its page: dialog.md)
- State: open (open / defaultOpen / onOpenChange); emails (emails / defaultEmails / onEmailsChange); drawn by data-focus-visible, data-state=open, data-disabled
- Types: InviteDialogRole = { value: string; label: string; description?: string }; InviteDialogValues = { emails: readonly string[]; role: string; message: string }
Keyboard
| Key | What it does |
|---|---|
| Escape | Close, keeping what was typed for the next opening (with the role's list open, close the list only) |
| Enter | In the addresses, make the typed address a tag; on the role's row, open its list or pick the active role |
| Backspace | In the empty addresses field, select the last tag; again, remove it |
| Space | On the role's row, open its list |
| ArrowDown | On the role's row, open its list; in it, move to the next role |
| Meta+Enter | Send |
| Control+Enter | Send |
| Tab | Move to the next field, the link or the send |
Accessibility
- The part itself answers the keys above.
- hover: the browser's own (:hover): write nothing
Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:
| State | Drawn by |
|---|---|
| focus-visible | the attribute data-focus-visible |
| expanded | the attribute data-state=open |
| open | the attribute data-state=open |
| disabled | the attribute data-disabled |
Notes for AI
Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.