Dashral Pro is on the wayGet 30% off at launch

Dashral

Team membersPro

The team and the invitations still out: invite several people with a role, change roles in place, suspend or remove someone, and resend or revoke an invite.

When to use

  • The team and its invitations: invite several people with a role, change roles, suspend or remove.
  • Any product with seats: workspace settings, admin consoles.

When not to use

  • Single-user products.
  • Managing customers rather than teammates: Orders table or a Data Table.

Usage

Team members with your own data: every prop has the sample as its default, so pass only what you have.

example.tsx
import { TeamMembers } from "@/components/dashral/blocks/team-members"

<TeamMembers
  members={members}
  invites={invites}
  seats={plan.seats}
  onInvite={(emails, role) => api.team.invite(emails, role)}
  onRoleChange={(id, role) => api.team.setRole(id, role)}
  onRemove={(id) => api.team.remove(id)}
/>

API reference

TeamMembers

A team page: who's in it, with their role and when they were last active, and the invitations still out. Invite several people at once with a role (seats count them), change a role in place, suspend, reactivate or remove someone, and resend, copy or revoke an invitation. The owner stays; you can't demote or remove yourself. Your team comes in as members and invites (a new list replaces what's shown), and every change goes to your handlers; one that throws is undone, with its message.

PropTypeDefault
workspacestring

The workspace, in "Who can sign in to …".

"Northwind Studio"
membersTeamMember[]sample
invitesTeamInvite[]sample
seatsnumber

Seats on the plan: invitations hold one until they're accepted or revoked.

10
inviteLink(invite: TeamInvite) => string

An invitation's link, for "Copy link".

sample
onInvite(emails: string[], role: TeamInvite["role"]) => Promise<TeamInvite[] | void> | TeamInvite[] | void

Invites people with a role; return the invitations made to show them (sample ones without it).

—
onRoleChange(id: TeamMember["id"], role: Exclude<TeamRole, "owner">) => Promise<void> | void—
onSuspend(id: TeamMember["id"], suspended: boolean) => Promise<void> | void—
onRemove(id: TeamMember["id"]) => Promise<void> | void—
onResend(id: TeamInvite["id"]) => Promise<void> | void

"Send a new link" for an invitation.

—
onRevoke(id: TeamInvite["id"]) => Promise<void> | void—

type TeamRole

= "owner" | "admin" | "member"

type TeamMember

PropTypeDefault
idnumber | string—
namestring—
emailstring—
roleRole—
activestring—
suspendedboolean—
youboolean—
srcstring—

type TeamInvite

PropTypeDefault
idnumber | string—
emailstring—
roleExclude<Role, "owner">—
sentstring—
expiredboolean—