Skip to content
Browse documentation

Settings → Members, done properly: invited addresses fly out of the field onto their rows, role pills grow into the list of roles, and seats roll.

Used forSettings → Members pagesWorkspace administrationClient portalsPlans with seat limits

Install with the shadcn CLI

$ npx shadcn@latest add @hairline/team-members

Older shadcn CLI, or a network that blocks ui.shadcn.com? Install by URL: shadcn add https://hairlineui.com/r/team-members.json. More

Templates

Need the whole page?

65 Next.js landing pages, each designed from scratch. Try any of them live; one is $39, all of them $159, and 8 are free.

Where it’s used

  • Settings → Members pages

    Invite people, change roles and remove them, in one place.

  • Workspace administration

    Seats, roles and pending invites for an organisation.

  • Client portals

    Let a client invite their own staff.

  • Plans with seat limits

    Show seats used and stop invites when none are left.

What it handles for you

Members pages are usually a table with a select per row, an Invite modal and a toast that says something happened somewhere. This puts inviting, roles, seats and removal in one place.

Instead of wiring upan invite modala members tablea role dropdown per rowa seat countera resend timera remove confirmation
  1. Invite many at once

    Paste a list of addresses, pick the role they join as, and “Invite 3” sends them.

  2. Invites land on their rows

    Each chip lifts out of the field and flies onto its new row, where the avatar opens in.

  3. Seats are counted

    “4 of 6 seats” rolls as people come and go, turns amber when none are left, and the field takes no more than fit.

  4. Roles change in place

    A role pill grows into the list of roles. If your server refuses, the old role returns and the reason shows under the name.

  5. Pending invites can be resent

    A countdown, “Resend in 0:28”, becomes a Resend link that says Sending and Sent.

  6. Removing asks first

    The bin stretches into “Remove”, a check draws, then the row folds away. You and locked members, such as an owner, can’t be removed here.

Overview

Members pages are usually a table with a select per row, an "Invite" modal and a toast that says something happened somewhere. Here the invite field sits above the list: paste a list of addresses (repeats fly into their twins), pick the role they join as, and "Invite 3" sends them. Each chip then lifts out of the field and flies down onto its new row, where the name lands as the avatar opens in. "4 of 6 seats" rolls as people come and go, and the field takes no more than the seats that are left. A role pill grows into the list of roles and folds back with the new one, a spinner riding in it while it saves; if your server refuses, the old role morphs back, the pill shakes and the reason lifts in under the name. Pending invites count down to Resend, which says Sending and Sent and starts the clock again. Removing someone stretches the bin into "Remove", draws a check and folds the row away.

States

invite
Addresses become chips in the invite field (tag input): pasted lists spill out of the caret, repeats fly into their twins and anything that isn't an address lands red. The button counts them: "Invite 3".
sending
Invite turns into "Inviting" while onInvite runs; the field holds still. If it throws, the addresses stay, the button says Try again and the reason takes the line under the field.
arrive
Each chip's copy lifts 6px out of the field and flies 680ms onto its row's name, 60ms after the one before, its outline fading as it lands; the name takes over and the avatar scales in from 0.6 out of a blur. The rows below glide down to make room.
seats
"4 of 6 seats" rolls with every invite and removal and turns amber when none are left; the field then refuses more and says how many fit.
role
The role pill's own surface grows from its right edge into the list of roles in 420ms (upward when there's no room below); the highlight glides between rows and a check draws beside the current one. Picking folds it back and the label morphs; a spinner replaces the chevron while onRoleChange runs.
refused
If onRoleChange throws, the old role morphs back, the pill shakes ±4px and the error's message lifts in over the line under the name for 3.6s.
resend
Pending invites say "Resend in 0:28", the seconds rolling down. Then Resend is a link; it morphs to Sending and Sent, the invite's time resets and the countdown opens again.
remove
The bin (or, for an invite, the crossed envelope) stretches into a red Remove / Cancel invite. A check draws, the row dims for 700ms, then folds away while the rest glide up.

Usage

usage.tsx
import { TeamMembers } from "@/components/team-members";<TeamMembers  defaultValue={members}  roles={[    { value: "admin", label: "Admin", description: "Members, billing and API keys" },    { value: "member", label: "Member", description: "Create and edit projects" },  ]}  seats={10}  onInvite={(emails, role) => api.invite(emails, role)}  onRoleChange={(member, role) => api.setRole(member.id, role)}  onRemove={(member) => api.remove(member.id)}  onResend={(member) => api.resend(member.id)}/>

Depends on lucide-react, installed for you by the CLI along with the keyframes it needs.

Works with

Organisation members with Better Auth

Members and pending invitations come from the organization plugin and are mapped to plain records. Each callback is one call to its client; what it throws (a seat limit, a missing permission) is what the row or the field says. Clerk Organizations, WorkOS or your own table fit the same way.

example.tsx
"use client";import { TeamMembers, type TeamMember } from "@/components/team-members";import { authClient } from "@/lib/auth-client";const roles = [  { value: "admin", label: "Admin", description: "Members, billing and API keys" },  { value: "member", label: "Member", description: "Create and edit projects" },];const fail = (r: { error?: { message?: string } | null }) => {  if (r.error) throw new Error(r.error.message ?? "That didn't work.");};export function Members({ initial, seats, me }: { initial: TeamMember[]; seats: number; me: string }) {  return (    <TeamMembers      defaultValue={initial.map((m) => ({ ...m, you: m.id === me, locked: m.role === "owner" }))}      roles={roles}      seats={seats}      onInvite={async (emails, role) => {        const sent = await Promise.all(emails.map((email) => authClient.organization.inviteMember({ email, role })));        sent.forEach(fail);        return sent.map((r) => ({ id: r.data!.id, email: r.data!.email, role, status: "invited", invitedAt: new Date() }));      }}      onRoleChange={async (m, role) => fail(await authClient.organization.updateMemberRole({ memberId: m.id, role }))}      onRemove={async (m) =>        fail(m.status === "invited"          ? await authClient.organization.cancelInvitation({ invitationId: m.id })          : await authClient.organization.removeMember({ memberIdOrEmail: m.id }))}      onResend={async (m) => fail(await authClient.organization.inviteMember({ email: m.email, role: m.role as "admin" | "member", resend: true }))}    />  );}

Props

value
TeamMember[]
Controlled members and invites: { id, email, name?, image?, role, status?, invitedAt?, lastActiveAt?, you?, locked? }.
defaultValue
TeamMember[]
Starting members when uncontrolled.
onValueChange
(members: TeamMember[]) => void
The list after every invite, role change, resend and removal. New invites come first.
roles
{ value, label, description? }[]
Roles people can be given, in menu order. A member whose role isn't listed (an owner) shows it as plain text.
inviteRole
string
The role new invites start with. The second role by default.
seats
number
Seats on the plan. Members and pending invites each take one; the field takes no more than are left.
onInvite
(emails, role) => Promise<TeamMember[]>
Sends invites and returns the new members (status "invited"). Throw to keep the addresses and show the message. Without it there is no invite field.
onRoleChange
(member, role) => Promise<unknown>
Saves a role; the pill changes at once and changes back if this throws. Without it roles are plain text.
onRemove
(member) => Promise<unknown>
Removes a member or cancels an invite. Never offered for you or locked members.
onResend
(member) => Promise<unknown>
Sends an invite again; the clock restarts from now.
resendAfter= 30
number
Seconds before an invite can be sent again.
suggestions
TagInputSuggestion[] | (query) => …
People to suggest in the invite field, e.g. from your directory.
title= "Members"
string
Heading and the list's accessible name.
description
string
The line under the heading.

Accessibility and motion

  • The invite field is a tag input (combobox and chip list, with its keyboard and announcements). The role pills are buttons that open a listbox: arrows move the highlight, Enter picks, Escape folds it back and returns focus to the pill.
  • Invites, role changes, refusals, resends and removals are announced in a status region outside the list. The resend countdown is hidden from screen readers; the button says when it can be used.
  • You and locked members (an owner) can't be removed here, and a locked member's role is plain text.
  • The chips' flight is a copy in an overlay, so the field and the list each settle on their own; rows glide with additive transforms and removed rows fold away as their own detached elements.
  • Reduced motion adds, changes and removes in place; the role list opens and closes without growing.

Requirements

React 19, Tailwind CSS v4 and shadcn/ui theme variables (any style, light and dark). Icons from lucide-react.

The CLI also installs Tag input, Text morph, Number roll, Status button.

Source

"use client";import * as React from "react";import { Mail, MailX, Trash2 } from "lucide-react";import { ConfirmAction } from "./confirm-action";import { NumberRoll } from "./number-roll";import { RelativeTime, toTime, type DateLike } from "./relative-time";import { StatusButton, type ActionStatus } from "./status-button";import { TagInput, type TagInputProps, type TagInputTag } from "./tag-input";import { RoleMenu, type TeamRole } from "./team-role-menu";import { TextMorph } from "./text-morph";import { useRowMotion } from "./use-row-motion";/* ───────────────────────────────────────────────────────── * TEAM MEMBERS: Settings → Members, done properly * *   invite    addresses go into the invite field (paste a list, *             duplicates fly into their twins); "Invite 3" sends *             them, and each chip lifts out of the field and *             flies down onto its new row in the list *   seats     "4 of 5 seats" rolls as people come and go; the *             field takes no more than the seats that are left *   role      the role pill grows into the list of roles and *             folds back with the new one; a spinner rides in *             the pill while it saves, and a refusal morphs the *             old role back with a shake *   resend    pending invites count down "Resend in 0:28", *             then offer Resend, which says Sending and Sent *             and starts the clock again *   remove    the bin stretches into "Remove", a check draws, *             the row folds away and the rest glide up * * Members are plain records; every change is one async * function, so it works with Clerk, Better Auth, WorkOS or * your own table. * ───────────────────────────────────────────────────────── */export type { TeamRole, DateLike };export interface TeamMember {  id: string;  email: string;  name?: string;  image?: string;  role: string;  /** "invited" until they accept. */  status?: "active" | "invited";  /** When the invite was last sent; the resend clock runs from it. */  invitedAt?: DateLike;  lastActiveAt?: DateLike | null;  /** The person looking at the page. */  you?: boolean;  /** Can't be changed or removed here, e.g. the owner. */  locked?: boolean;}export interface TeamMembersProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange"> {  value?: TeamMember[];  defaultValue?: TeamMember[];  onValueChange?: (members: TeamMember[]) => void;  roles: TeamRole[];  /** The role new invites start with; the second role by default. */  inviteRole?: string;  /** Seats on the plan. Members and pending invites both take one. */  seats?: number;  /** Sends invites. Return the new members (status "invited"); throw to keep the addresses and say why. */  onInvite?: (emails: string[], role: string) => Promise<TeamMember[]>;  /** Saves a role. Throw to put the old one back. */  onRoleChange?: (member: TeamMember, role: string) => Promise<unknown> | unknown;  /** Removes a member or cancels an invite. */  onRemove?: (member: TeamMember) => Promise<unknown> | unknown;  /** Sends an invite again. */  onResend?: (member: TeamMember) => Promise<unknown> | unknown;  /** Seconds before an invite can be sent again. */  resendAfter?: number;  /** People to suggest in the invite field (your directory). */  suggestions?: TagInputProps["suggestions"];  title?: string;  description?: string;}type Actions = {  role: (m: TeamMember, role: string) => void;  remove: (m: TeamMember) => Promise<void>;  resend: (m: TeamMember) => Promise<void>;};const EASE = "cubic-bezier(0.16,1,0.3,1)";const FOCUS = "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40";const NONE: TeamMember[] = [];const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;const SPLIT = /[\s,;]+/;const lower = (v: string) => v.toLowerCase();const validate = (v: string) => (EMAIL.test(v) ? null : `“${v}” isn’t an email address`);const message = (e: unknown, fallback: string) => (e instanceof Error && e.message ? e.message : fallback);const two = { minimumIntegerDigits: 2 };const reducedQuery = "(prefers-reduced-motion: reduce)";const subscribeReduced = (onChange: () => void) => {  const query = window.matchMedia(reducedQuery);  query.addEventListener("change", onChange);  return () => query.removeEventListener("change", onChange);};const useReducedMotion = () =>  React.useSyncExternalStore(subscribeReduced, () => window.matchMedia(reducedQuery).matches, () => false);const initials = (m: TeamMember) =>  (m.name ?? m.email)    .split(/[\s@._-]+/)    .filter(Boolean)    .slice(0, 2)    .map((w) => w[0]!.toUpperCase())    .join("");function Avatar({ m }: { m: TeamMember }) {  if (m.status === "invited")    return (      <span data-avatar="" className="grid size-8 shrink-0 place-items-center rounded-full border border-dashed border-border text-muted-foreground">        <Mail className="size-3.5" strokeWidth={1.75} aria-hidden="true" />      </span>    );  if (m.image)    // eslint-disable-next-line @next/next/no-img-element    return <img data-avatar="" src={m.image} alt="" className="size-8 shrink-0 rounded-full object-cover shadow-[0_0_0_1px_var(--border)]" />;  return (    <span data-avatar="" aria-hidden="true" className="grid size-8 shrink-0 place-items-center rounded-full bg-muted text-[11px] font-medium text-muted-foreground shadow-[inset_0_0_0_1px_var(--border)]">      {initials(m)}    </span>  );}/** A piece of a line that opens and closes sideways (a countdown after "Resend in"). */function Reveal({ open, reduced, children }: { open: boolean; reduced: boolean; children: React.ReactNode }) {  return (    <span      aria-hidden={!open || undefined}      className="inline-grid"      style={{        gridTemplateColumns: open ? "1fr" : "0fr",        opacity: open ? 1 : 0,        filter: open || reduced ? "none" : "blur(3px)",        transition: reduced ? "none" : `grid-template-columns 380ms ${EASE}, opacity 260ms ${EASE}, filter 260ms ${EASE}`,      }}    >      <span className="min-w-0 [clip-path:inset(-4px_0)]">{children}</span>    </span>  );}/** "Resend in 0:28", rolling down; then Resend → Sending → Sent, and the clock starts again. */function Resend({ since, after, reduced, onResend }: { since: number; after: number; reduced: boolean; onResend: () => Promise<void> }) {  const [now, setNow] = React.useState<number | null>(null);  const [status, setStatus] = React.useState<ActionStatus>("idle");  const left = now === null ? 0 : Math.max(0, since + after * 1000 - now);  const counting = now !== null && left > 0;  React.useEffect(() => {    const timer = window.setTimeout(() => setNow(Date.now()), 0);    return () => window.clearTimeout(timer);  }, [since]);  React.useEffect(() => {    if (!counting) return;    const timer = window.setTimeout(() => setNow(Date.now()), 1000 - (Date.now() % 1000) + 10);    return () => window.clearTimeout(timer);  }, [counting, now]);  React.useEffect(() => {    if (status !== "success" && status !== "error") return;    const timer = window.setTimeout(() => setStatus("idle"), status === "success" ? 1400 : 2400);    return () => window.clearTimeout(timer);  }, [status]);  const busy = status === "pending" || status === "success";  const label = status === "pending" ? "Sending" : status === "success" ? "Sent" : status === "error" ? "Try again" : counting ? "Resend in" : "Resend";  const s = Math.ceil(left / 1000);  const ready = !counting && !busy;  return (    <button      type="button"      aria-disabled={!ready || undefined}      aria-label={counting ? "Resend invite, available shortly" : "Resend invite"}      onClick={async () => {        if (!ready) return;        setStatus("pending");        try {          await onResend();          setStatus("success");        } catch {          setStatus("error");        }      }}      className={`inline-flex cursor-pointer items-baseline rounded-sm whitespace-nowrap tabular-nums transition-colors duration-200 aria-disabled:cursor-default ${FOCUS} ${        status === "error" ? "text-red-600 dark:text-red-400" : ready ? "font-medium text-foreground underline-offset-2 hover:underline" : ""      }`}    >      <TextMorph>{label}</TextMorph>      <Reveal open={counting && status === "idle"} reduced={reduced}>        <span className="inline-flex items-baseline pl-[0.25em]">          <NumberRoll value={Math.floor(s / 60)} direction="down" />:          <NumberRoll value={s % 60} format={two} direction="down" />        </span>      </Reveal>    </button>  );}/** A refusal, lifted in over the line under the name and lifted out again. */function Note({ text, reduced }: { text?: string; reduced: boolean }) {  const [shown, setShown] = React.useState(text);  if (text && text !== shown) setShown(text);  return (    <span      aria-hidden="true"      className="pointer-events-none absolute inset-x-0 top-0 truncate text-red-600 dark:text-red-400"      style={{        opacity: text ? 1 : 0,        transform: text || reduced ? "none" : "translateY(-4px)",        filter: text || reduced ? "none" : "blur(3px)",        transition: reduced ? "none" : `opacity 260ms ${EASE} ${text ? 80 : 0}ms, transform 360ms ${EASE}, filter 260ms ${EASE}`,      }}    >      {shown}    </span>  );}interface RowProps {  m: TeamMember;  roles: TeamRole[];  saving: boolean;  shake: number;  /** Why the last change was refused; shown in place of the line under the name for a while. */  note?: string;  gone: boolean;  canEdit: boolean;  canRemove: boolean;  canResend: boolean;  resendAfter: number;  reduced: boolean;  act: React.RefObject<Actions>;}const MemberRow = React.memo(function MemberRow({ m, roles, saving, shake, note, gone, canEdit, canRemove, canResend, resendAfter, reduced, act }: RowProps) {  const invited = m.status === "invited";  const display = m.name ?? m.email;  const role = roles.find((r) => r.value === m.role)?.label ?? m.role;  const removable = canRemove && !m.locked && !m.you;  return (    <li data-row-id={m.id} className="border-t border-border first:border-t-0">      <div className="flex items-center gap-3 px-4 py-2.5 transition-opacity duration-300 @md:px-5" style={{ opacity: gone ? 0.5 : 1 }}>        <Avatar m={m} />        <div className="min-w-0 flex-1">          <p className="flex min-w-0 items-center gap-1.5 text-[13.5px] font-medium tracking-[-0.01em]">            <span data-name="" className="truncate">              {display}            </span>            {m.you && <span className="shrink-0 rounded-full px-1.5 text-[11px] font-normal text-muted-foreground shadow-[inset_0_0_0_1px_var(--border)]">You</span>}          </p>          <p className="relative mt-0.5 text-[11.5px] text-muted-foreground">            <Note text={note} reduced={reduced} />            <span              className="flex min-w-0 items-baseline gap-x-1.5"              style={{ opacity: note ? 0 : 1, filter: note && !reduced ? "blur(3px)" : "none", transition: reduced ? "none" : `opacity 220ms ${EASE}, filter 220ms ${EASE}` }}            >            {/* On a narrow card the name is enough; the address comes back when there's room. */}            {m.name && <span className="hidden min-w-0 truncate @md:inline">{m.email}</span>}            {m.name && (invited || m.lastActiveAt) && (              <span aria-hidden="true" className="hidden @md:inline">                ·              </span>            )}            {invited ? (              <>                <span className="shrink-0 @md:hidden">Invited</span>                <span className="hidden shrink-0 @md:inline">{m.invitedAt ? <RelativeTime date={m.invitedAt} prefix="Invited" /> : "Invited"}</span>                {canResend && (                  <>                    <span aria-hidden="true">·</span>                    <Resend since={m.invitedAt ? toTime(m.invitedAt) : 0} after={resendAfter} reduced={reduced} onResend={() => act.current.resend(m)} />                  </>                )}              </>            ) : m.lastActiveAt ? (              <RelativeTime className="shrink-0" date={m.lastActiveAt} prefix="Active" />            ) : null}            </span>          </p>        </div>        {canEdit && !m.locked ? (          <RoleMenu roles={roles} value={m.role} onValueChange={(r) => act.current.role(m, r)} saving={saving} shake={shake} label={`Role for ${display}`} />        ) : (          <span className="shrink-0 px-2.5 text-[12px] text-muted-foreground">{role}</span>        )}        {canRemove && (          <div className="-mr-1 flex min-w-7 shrink-0 justify-end">            {removable && (              <ConfirmAction                icon={invited ? <MailX strokeWidth={1.75} /> : <Trash2 strokeWidth={1.75} />}                label={invited ? `Cancel invite for ${display}` : `Remove ${display}`}                labels={invited ? { idle: "Cancel invite", pending: "Cancelling", success: "Cancelled", error: "Try again" } : { idle: "Remove", pending: "Removing", success: "Removed", error: "Try again" }}                onConfirm={() => act.current.remove(m)}              />            )}          </div>        )}      </div>    </li>  );});export function TeamMembers({  value,  defaultValue = NONE,  onValueChange,  roles,  inviteRole,  seats,  onInvite,  onRoleChange,  onRemove,  onResend,  resendAfter = 30,  suggestions,  title = "Members",  description = "People in this workspace and the invites waiting on them.",  className = "",  ...props}: TeamMembersProps) {  const reduced = useReducedMotion();  const [inner, setInner] = React.useState(defaultValue);  const members = value ?? inner;  const [tags, setTags] = React.useState<TagInputTag[]>([]);  const [role, setRole] = React.useState(() => inviteRole ?? roles[Math.min(1, roles.length - 1)]?.value ?? "");  const [sending, setSending] = React.useState<ActionStatus>("idle");  const [inviteError, setInviteError] = React.useState<string | null>(null);  const [saving, setSaving] = React.useState<Record<string, boolean>>({});  const [shakes, setShakes] = React.useState<Record<string, number>>({});  const [notes, setNotes] = React.useState<Record<string, string>>({});  const [gone, setGone] = React.useState<string[]>([]);  const [announce, setAnnounce] = React.useState("");  const rootRef = React.useRef<HTMLDivElement>(null);  const fieldRef = React.useRef<HTMLDivElement>(null);  const listRef = React.useRef<HTMLUListElement>(null);  const ghostRef = React.useRef<HTMLDivElement>(null);  const flyRef = React.useRef<HTMLDivElement>(null);  const flights = React.useRef(new Map<string, { rect: DOMRect; label: string }>());  const latest = React.useRef(members);  React.useLayoutEffect(() => {    latest.current = members;  });  const commit = (next: TeamMember[]) => {    if (value === undefined) setInner(next);    onValueChange?.(next);  };  const used = members.length;  const left = seats === undefined ? undefined : Math.max(0, seats - used);  const valid = tags.filter((t) => !t.error);  const ranks = React.useMemo(() => new Map(members.map((m, i) => [m.id, i])), [members]);  useRowMotion(listRef, { reduced, ranks, ghosts: ghostRef });  const act = React.useRef<Actions>(null!);  React.useLayoutEffect(() => {    act.current = {      role: async (m, next) => {        const prev = m.role;        const name = m.name ?? m.email;        const label = roles.find((r) => r.value === next)?.label ?? next;        commit(latest.current.map((x) => (x.id === m.id ? { ...x, role: next } : x)));        setSaving((s) => ({ ...s, [m.id]: true }));        try {          await onRoleChange?.(m, next);          setAnnounce(`${name} is now ${label}.`);        } catch (e) {          commit(latest.current.map((x) => (x.id === m.id ? { ...x, role: prev } : x)));          setShakes((s) => ({ ...s, [m.id]: (s[m.id] ?? 0) + 1 }));          const why = message(e, `${name}'s role couldn't be changed.`);          setNotes((n) => ({ ...n, [m.id]: why }));          setAnnounce(why);          window.setTimeout(() => setNotes((n) => (n[m.id] === why ? Object.fromEntries(Object.entries(n).filter(([k]) => k !== m.id)) : n)), 3600);        } finally {          setSaving((s) => Object.fromEntries(Object.entries(s).filter(([k]) => k !== m.id)));        }      },      remove: async (m) => {        await onRemove?.(m);        setGone((g) => [...g, m.id]);        setAnnounce(m.status === "invited" ? `Invite for ${m.email} cancelled.` : `${m.name ?? m.email} removed.`);        // Long enough for the check to draw; then the row folds away.        window.setTimeout(() => {          commit(latest.current.filter((x) => x.id !== m.id));          setGone((g) => g.filter((id) => id !== m.id));        }, 700);      },      resend: async (m) => {        await onResend?.(m);        commit(latest.current.map((x) => (x.id === m.id ? { ...x, invitedAt: new Date() } : x)));        setAnnounce(`Invite sent to ${m.email} again.`);      },    };  });  const invite = async () => {    if (!onInvite || !valid.length || sending === "pending") return;    setSending("pending");    setInviteError(null);    try {      const added = await onInvite(        valid.map((t) => t.value),        role,      );      // Where each chip sits now, so its row can fly out of it.      const at = new Map<string, { rect: DOMRect; label: string }>();      for (const t of valid) {        const el = fieldRef.current?.querySelector<HTMLElement>(`[data-token="${CSS.escape(t.id)}"]`);        if (el) at.set(t.value.toLowerCase(), { rect: el.getBoundingClientRect(), label: t.label ?? t.value });      }      flights.current = at;      commit([...added, ...latest.current]);      setTags((ts) => ts.filter((t) => t.error));      setSending("success");      setAnnounce(`${added.length} ${added.length === 1 ? "invite" : "invites"} sent.`);    } catch (e) {      setSending("error");      setInviteError(message(e, "The invites couldn't be sent. Try again."));    }  };  // New rows that came from chips: each chip's copy flies from the field onto its row's name.  React.useLayoutEffect(() => {    const queued = flights.current;    if (!queued.size) return;    flights.current = new Map();    const root = rootRef.current;    const layer = flyRef.current;    const list = listRef.current;    if (!root || !layer || !list || reduced) return;    const box = root.getBoundingClientRect();    let i = 0;    for (const m of members) {      const from = queued.get(m.email.toLowerCase());      if (!from) continue;      const row = list.querySelector<HTMLElement>(`[data-row-id="${CSS.escape(m.id)}"]`);      const name = row?.querySelector<HTMLElement>("[data-name]");      const avatar = row?.querySelector<HTMLElement>("[data-avatar]");      if (!row || !name) continue;      const to = name.getBoundingClientRect();      const copy = document.createElement("span");      copy.textContent = from.label;      copy.className =        "absolute left-0 top-0 inline-flex h-7 items-center whitespace-nowrap rounded-full bg-background px-2.5 text-[13px] font-medium text-foreground shadow-[inset_0_0_0_1px_var(--border)] will-change-transform";      layer.appendChild(copy);      const x0 = from.rect.left - box.left;      const y0 = from.rect.top - box.top + (from.rect.height - 28) / 2;      const x1 = to.left - box.left - 10;      const y1 = to.top - box.top + to.height / 2 - 14;      const delay = i++ * 60;      // Lift off, travel, then hand over to the row's own name: the copy blurs out as the name sharpens in.      const flight = copy.animate(        [          { transform: `translate(${x0}px, ${y0}px)`, opacity: 1, filter: "blur(0px)", boxShadow: "inset 0 0 0 1px var(--border)", easing: "cubic-bezier(0.3,0,0.2,1)" },          { transform: `translate(${x0}px, ${y0 - 6}px)`, opacity: 1, filter: "blur(0px)", offset: 0.14, easing: EASE },          { transform: `translate(${x1}px, ${y1}px)`, opacity: 1, filter: "blur(0px)", boxShadow: "inset 0 0 0 1px transparent", backgroundColor: "transparent", offset: 0.7, easing: "linear" },          { transform: `translate(${x1}px, ${y1}px)`, opacity: 0, filter: "blur(4px)", boxShadow: "inset 0 0 0 1px transparent", backgroundColor: "transparent" },        ],        { duration: 680, delay, fill: "both" },      );      flight.onfinish = flight.oncancel = () => copy.remove();      name.animate(        [          { opacity: 0, filter: "blur(4px)" },          { opacity: 0, filter: "blur(4px)", offset: (delay + 680 * 0.66) / (delay + 680) },          { opacity: 1, filter: "blur(0px)" },        ],        { duration: delay + 680, easing: "linear" },      );      avatar?.animate([{ opacity: 0, transform: "scale(0.6)", filter: "blur(3px)" }, { opacity: 1, transform: "none", filter: "blur(0px)" }], { duration: 420, delay: delay + 360, easing: EASE, fill: "backwards" });    }  }, [members, reduced]);  const count = valid.length;  return (    <div ref={rootRef} className={`@container relative w-full rounded-[22px] border border-border bg-background text-foreground ${className}`} {...props}>      <div className="flex items-start justify-between gap-3 px-4 pt-4 pb-3.5 @md:px-5 @md:pt-5">        <div className="min-w-0">          <p className="flex items-baseline gap-2 text-[14px] font-medium tracking-[-0.01em]">            {title}            <span className="text-[12px] font-normal text-muted-foreground tabular-nums">              <NumberRoll value={members.filter((m) => m.status !== "invited").length} />            </span>          </p>          <p className="mt-0.5 text-[12px] text-muted-foreground">{description}</p>        </div>        {seats !== undefined && (          <p className={`flex shrink-0 items-baseline whitespace-nowrap pt-0.5 text-[11.5px] tabular-nums transition-colors duration-300 ${left === 0 ? "text-amber-700 dark:text-amber-400" : "text-muted-foreground"}`}>            <NumberRoll value={used} />            &nbsp;of&nbsp;            <NumberRoll value={seats} />            &nbsp;<TextMorph>{seats === 1 ? "seat" : "seats"}</TextMorph>          </p>        )}      </div>      {onInvite && (        <div ref={fieldRef} className="px-4 pb-4 @md:px-5">          <TagInput            value={tags}            onValueChange={(next) => {              setTags(next);              setInviteError(null);              if (sending !== "pending") setSending("idle");            }}            label="Invite by email"            placeholder="Emails, separated by commas"            hint={inviteError ?? (left === 0 ? "Every seat is taken. Remove someone or add seats to invite more." : "Paste a list or pick from your directory.")}            validate={validate}            normalize={lower}            separators={SPLIT}            suggestions={suggestions}            createLabel={(text) => `Invite “${text}”`}            max={left}            limitMessage={left === 1 ? "One seat left on your plan." : `${left} seats left on your plan.`}            collapse={2}            disabled={sending === "pending"}          />          <div className="mt-3 flex items-center justify-end gap-2">            <RoleMenu roles={roles} value={role} onValueChange={setRole} label="Role for new members" prefix="as" />            <StatusButton              size="sm"              status={sending}              labels={{ idle: count > 1 ? `Invite ${count}` : "Invite", pending: "Inviting", success: "Invited", error: "Try again" }}              onClick={invite}              onReset={() => setSending("idle")}              aria-disabled={(!count && sending === "idle") || undefined}              className={!count && sending === "idle" ? "pointer-events-none opacity-50" : ""}            />          </div>        </div>      )}      <div className="relative border-t border-border">        <ul ref={listRef} aria-label={title} className="relative">          {members.map((m) => (            <MemberRow              key={m.id}              m={m}              roles={roles}              saving={Boolean(saving[m.id])}              shake={shakes[m.id] ?? 0}              note={notes[m.id]}              gone={gone.includes(m.id)}              canEdit={Boolean(onRoleChange)}              canRemove={Boolean(onRemove)}              canResend={Boolean(onResend)}              resendAfter={resendAfter}              reduced={reduced}              act={act}            />          ))}        </ul>        {/* Rows that went: their own elements, folding away where they stood (see use-row-motion). */}        <div ref={ghostRef} aria-hidden="true" className="pointer-events-none absolute inset-0" />      </div>      {/* Chips on their way from the field to their rows. */}      <div ref={flyRef} aria-hidden="true" className="pointer-events-none absolute inset-0 z-20" />      <span className="sr-only" role="status">        {announce}      </span>    </div>  );}

Registry item: /r/team-members.json