shadcn.io is an independent project built on shadcn/ui
Email is empty. The role select offers Admin, Member, and Viewer, and starts on Member. Send Invite does not send mail.
Use a select for a fixed list of roles. Two options can be radios. Once the form grows, use a Dialog. In React, Base UI does not send the invite.
Installation
Anatomy

Usage
<AlertDialog>
<AlertDialogTrigger render={<Button variant="outline" />}>
Add Member
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Invite Team Member</AlertDialogTitle>
<AlertDialogDescription>
Add a new member to your team with a specific role.
</AlertDialogDescription>
</AlertDialogHeader>
<FieldGroup>
<Field>
<FieldLabel htmlFor="invite-email">Email Address</FieldLabel>
<Input
id="invite-email"
name="email"
placeholder="name@example.com"
type="email"
/>
</Field>
<Field>
<FieldLabel htmlFor="invite-role">Role</FieldLabel>
<Select defaultValue="member" items={roles}>
<SelectTrigger className="w-full" id="invite-role">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectGroup>
{roles.map((role) => (
<SelectItem key={role.value} value={role.value}>
{/* The rest of the file is under Installation. */}FAQ
Should the select come before or after the input?
After it. Ask for the specific detail, the email, before the categorization, the role.
Should the select have a default?
Yes, the most common choice: Member here. A Please select placeholder only adds a click for most people.
How are the roles passed?
From a static list at module scope. The list goes to items and defaultValue is the role's value.
How do I make both fields required?
Keep the default role so the select always has a value, and disable Send Invite until the email is valid.
Does the select's list work inside the dialog?
Yes. It opens in a layer above the dialog and keeps focus inside it. Keep the list short; for many options use a Combobox with search.
API Reference
Alert Dialog
No extra props in this demo. The rest is on the Alert Dialog page.
Button
Sets variant="outline". The rest is on the Button page.
Field
Sets htmlFor="invite-email" and htmlFor="invite-role". The rest is on the Field page.
Input
Sets id="invite-email", name="email", placeholder="name@example.com" and type="email". The rest is on the Input page.
Select
Sets defaultValue="member", items={roles}, id="invite-role" and value={role.value}. The rest is on the Select page.





