Sign Up Form
beui/signup-formFreeBlock
Composed sign-up form that flags a field only once it is left, then clears the moment it is fixed, with a length-weighted strength meter, password reveal and an animated submit lifecycle.
Install it
npx shadcn@latest add https://beui.dev/r/signup-form.jsonSource
1"use client";2// beui.dev/components/blocks/signup-form34import { Eye, EyeOff, Lock, Mail, User } from "lucide-react";5import { AnimatePresence, motion, useReducedMotion } from "motion/react";6import {7 type FormEvent,8 type ReactNode,9 useCallback,10 useId,11 useMemo,12 useState,13} from "react";14import { StatefulButton } from "@/components/motion/button";15import { Checkbox } from "@/components/motion/checkbox";16import { Input } from "@/components/motion/input";17import { EASE_OUT, SPRING_LAYOUT } from "@/lib/ease";18import { cn } from "@/lib/utils";1920export type SignUpStatus = "idle" | "loading" | "success" | "error";2122export type SignUpValues = {23 name: string;24 email: string;25 password: string;26 confirmPassword: string;27 terms: boolean;28};2930export type SignUpErrors = Partial<Record<keyof SignUpValues, string>>;3132export type SignUpFormClassNames = {33 root?: string;34 header?: string;35 title?: string;36 description?: string;37 fields?: string;38 strength?: string;39 terms?: string;40 submit?: string;41 footer?: string;42};4344export interface SignUpFormProps {45 /** Controlled values. Omit for uncontrolled. */46 values?: SignUpValues;47 defaultValues?: Partial<SignUpValues>;48 onValuesChange?: (values: SignUpValues) => void;49 /** Called with valid values only. Return a promise to drive the button state. */50 onSubmit?: (values: SignUpValues) => void | Promise<void>;51 /** Replace the built-in rules — return a message per invalid field. */52 validate?: (values: SignUpValues) => SignUpErrors;53 /** Controlled submit state. Omit to let the form track it. */54 status?: SignUpStatus;55 /** Form-level failure message, shown above the submit button. */56 errorMessage?: string;57 title?: ReactNode;58 description?: ReactNode;59 submitLabel?: string;60 footer?: ReactNode;61 /** Show the password strength meter. */62 strengthMeter?: boolean;63 className?: string;64 classNames?: SignUpFormClassNames;65}6667const EMPTY_VALUES: SignUpValues = {68 name: "",69 email: "",70 password: "",71 confirmPassword: "",72 terms: false,73};7475// Deliberately permissive. Full RFC 5322 matching is impractical in a regex and76// rejects addresses that deliver fine; the only real check is sending mail.77const EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;7879const MIN_PASSWORD_LENGTH = 8;8081const STRENGTH_LABELS = ["Too short", "Weak", "Fair", "Good", "Strong"] as const;8283const STRENGTH_COLORS = [84 "bg-destructive",85 "bg-destructive",86 "bg-amber-500",87 "bg-amber-400",88// … truncated
What it pulls in
npm packages
Files it writes
More from beui
All 104 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| File Upload Attachment Uploadattachment-upload | beui | Blocks | Free | 4 deps · 5 files | |
| Availability Scheduleravailability-scheduler | beui | Blocks | Free | 4 deps · 15 files | |
| Bloom Menubloom-menu | beui | Blocks | Free | 4 deps · 3 files | |
| Command Palettecommand-palette | beui | Blocks | Free | 4 deps · 3 files | |
| Dynamic Islanddynamic-island | beui | Blocks | Free | 3 deps · 3 files | |
| Expandable Action Barexpandable-action-bar | beui | Blocks | Free | 3 deps · 2 files | |
| Expandable Tabsexpandable-tabs | beui | Blocks | Free | 3 deps · 3 files | |
| Feedback Widgetfeedback-widget | beui | Blocks | Free | 4 deps · 9 files |
