Componentfeedback1.57 KB gzipZero dependencies
Invite Modal
Invite modal with email, role radio group and sent confirmation.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add invite-modalOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { InviteModal } from "@/components/ui/invite-modal"; <InviteModal />Source code
invite-modal.tsx + 2 helpersZero 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 />| Prop | Type | Description |
|---|---|---|
| open | boolean | Controlled open visibility state. |
| onOpenChange | (open: boolean) => void | Callback invoked on open change. |
| roles | string[] | Configures roles. (Default: ["admin", "editor", "member"]) |
| onSend | (email: string, role: string) => void | Callback invoked on send. |