Componentfeedback1.57 KB gzipZero dependencies

Invite Modal

Invite modal with email, role radio group and sent confirmation.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add invite-modal

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { InviteModal } from "@/components/ui/invite-modal"; <InviteModal />

Source code

invite-modal.tsx + 2 helpers

Zero third-party dependencies (3 local files shown in tabs below).

tsxinvite-modal.tsx140 lines
"use client"; import * as React from "react";import { getFocusable, lockBodyScroll, registerEscapeLayer, trapFocus } from "./lib/focus-trap";import { cn } from "./lib/utils";export interface InviteModalProps extends React.HTMLAttributes<HTMLElement> {  open: boolean;  onOpenChange: (open: boolean) => void;  roles?: string[];  onSend?: (email: string, role: string) => void;} /** Team member invite modal: email + role selector + dispatch state. */export function InviteModal({ open, onOpenChange, roles = ["admin", "editor", "member"], onSend, ...props }: InviteModalProps) {  const [email, setEmail] = React.useState("");  const [role, setRole] = React.useState(roles[roles.length - 1]);  const [sent, setSent] = React.useState(false);  const valid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { InviteModal } from "@/components/ui/invite-modal"; <InviteModal />
PropTypeDescription
openbooleanControlled open visibility state.
onOpenChange(open: boolean) => voidCallback invoked on open change.
rolesstring[]Configures roles. (Default: ["admin", "editor", "member"])
onSend(email: string, role: string) => voidCallback invoked on send.