Victor Mesquita

Sign-up Card

Cards

About

A compound account-creation form card with social sign-up providers, password strength guidance, terms consent, and verification/error states.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Sign-up Card to your project and fits it to your theme.

Code

How Sign-up Card is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import {
  SignUpCard,
  SignUpCardBody,
  SignUpCardCheckbox,
  SignUpCardConsent,
  SignUpCardDescription,
  SignUpCardDivider,
  SignUpCardError,
  SignUpCardField,
  SignUpCardFieldMessage,
  SignUpCardFields,
  SignUpCardFooter,
  SignUpCardHeader,
  SignUpCardInput,
  SignUpCardLabel,
  SignUpCardPasswordGuide,
  SignUpCardPasswordRequirement,
  SignUpCardProvider,
  SignUpCardProviders,
  type SignUpCardStatus,
  SignUpCardSubmit,
  SignUpCardTitle,
  SignUpCardVerification,
} from "@/components/ui/sign-up-card";
import { Building2, Code2 } from "lucide-react";
import { type FormEvent, useEffect, useRef, useState } from "react";

export default function SignUpCardDemo() {
  const [status, setStatus] = useState<SignUpCardStatus>("idle");
  const [password, setPassword] = useState("Preview123!");
  const timerRef = useRef<number | null>(null);
  const hasMinimumLength = password.length >= 8;
  const hasNumberOrSymbol = /[\d\W]/.test(password);

  useEffect(
    () => () => {
      if (timerRef.current) window.clearTimeout(timerRef.current);
    },
    [],
  );

  function finishAccountCreation(success: boolean) {
    if (timerRef.current) window.clearTimeout(timerRef.current);
    setStatus("submitting");
    timerRef.current = window.setTimeout(
      () => setStatus(success ? "verification" : "error"),
      800,
    );
  }

  function handleSubmit(event: FormEvent<HTMLFormElement>) {
    event.preventDefault();
    finishAccountCreation(hasMinimumLength && hasNumberOrSymbol);
  }

  return (
    <div className="flex w-full items-center justify-center p-8">
      <div className="w-full max-w-[400px]">
        <SignUpCard variant="card" status={status} onSubmit={handleSubmit}>
          <SignUpCardHeader>
            <SignUpCardTitle>
              {status === "verification"
                ? "Check your inbox"
                : "Create your account"}
            </SignUpCardTitle>
            <SignUpCardDescription>
              {status === "verification"
                ? "We sent a verification link to hello@acme.co."
                : "Start with SSO or use your work email."}
            </SignUpCardDescription>
          </SignUpCardHeader>

          {status === "verification" ? (
            <SignUpCardVerification>
              <span>Open the link to finish creating your account.</span>
              <button
                type="button"
                className="inline-flex h-7 items-center rounded-full px-3 text-[12.5px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
                onClick={() => setStatus("idle")}
              >
                Use another email
              </button>
            </SignUpCardVerification>
          ) : (
            <SignUpCardBody>
              <SignUpCardProviders>
                <SignUpCardProvider onClick={() => finishAccountCreation(true)}>
                  <Building2 strokeWidth={1.8} aria-hidden="true" />
                  Continue with SSO
                </SignUpCardProvider>
                <SignUpCardProvider onClick={() => finishAccountCreation(true)}>
                  <Code2 strokeWidth={1.8} aria-hidden="true" />
                  Continue with GitHub
                </SignUpCardProvider>
              </SignUpCardProviders>
              <SignUpCardDivider />
              <SignUpCardFields>
                <SignUpCardField>
                  <SignUpCardLabel>Name</SignUpCardLabel>
                  <SignUpCardInput
                    name="name"
                    autoComplete="name"
                    defaultValue="Alex Morgan"
                    required
                  />
                </SignUpCardField>
                <SignUpCardField>
                  <SignUpCardLabel>Work email</SignUpCardLabel>
                  <SignUpCardInput
                    name="email"
                    type="email"
                    autoComplete="email"
                    defaultValue="hello@acme.co"
                    required
                  />
                </SignUpCardField>
                <SignUpCardField invalid={status === "error"}>
                  <SignUpCardLabel>Password</SignUpCardLabel>
                  <SignUpCardInput
                    name="password"
                    revealable
                    autoComplete="new-password"
                    aria-describedby="preview-password-requirements"
                    value={password}
                    onChange={(event) => {
                      setPassword(event.currentTarget.value);
                      if (status === "error") setStatus("idle");
                    }}
                    required
                  />
                  <SignUpCardPasswordGuide id="preview-password-requirements">
                    <SignUpCardPasswordRequirement met={hasMinimumLength}>
                      At least 8 characters
                    </SignUpCardPasswordRequirement>
                    <SignUpCardPasswordRequirement met={hasNumberOrSymbol}>
                      One number or symbol
                    </SignUpCardPasswordRequirement>
                  </SignUpCardPasswordGuide>
                  {status === "error" ? (
                    <SignUpCardFieldMessage>
                      Meet both password requirements and try again.
                    </SignUpCardFieldMessage>
                  ) : null}
                </SignUpCardField>
                <SignUpCardConsent>
                  <SignUpCardCheckbox name="terms" defaultChecked required />
                  <span>
                    I agree to the <a href="#terms">Terms</a> and{" "}
                    <a href="#privacy">Privacy Policy</a>.
                  </span>
                </SignUpCardConsent>
                <SignUpCardError>
                  We could not create your account. Review the password and try
                  again.
                </SignUpCardError>
                <SignUpCardSubmit>
                  {status === "error" ? "Try again" : "Create account"}
                </SignUpCardSubmit>
              </SignUpCardFields>
            </SignUpCardBody>
          )}

          <SignUpCardFooter>
            Already have an account? <a href="#sign-in">Sign in</a>
          </SignUpCardFooter>
        </SignUpCard>
      </div>
    </div>
  );
}

Dependencies

More by Victor Mesquita

View all
  • Data Table Toolbar

    Data Table Toolbar

    10
  • Uai Blocks Community Feed

    Uai Blocks Community Feed

    5
  • Task List

    Task List

    4
  • Status Banner

    Status Banner

  • Password Recovery

    Password Recovery

  • Calendar View

    Calendar View

  • Document Field

    Document Field

  • Form Error Summary

    Form Error Summary

More in Cards

View all
  • Course Design Cards

    Course Design Cards

    1.3K
  • Approval Card

    Approval Card

    37
  • Card Studio

    Card Studio

    37
  • Stats cards with links

    Stats cards with links

    102
  • Card

    Card

    65
  • Statistics Card 2

    Statistics Card 2

    314
  • Feature UI Row

    Feature UI Row

    37
  • Photo Deck

    Photo Deck

    62