Account & Workspace Signup Card
Focused account setup form: two-column fields that stack on mobile, clear labels with short helper lines, role selector cards, password with show/hide and live requirements, an unticked marketing consent checkbox, inline validation, and a success state.
Install UI SDK & packages
npm install @ui-sdk/react @ui-sdk/core lucide-react
Give your agent the UI SDK skill
npx skills add vercel-labs/ui --skill ui-sdk
"use client"; import * as React from "react"; import { ArrowRight, Check, Eye, EyeOff, Minus, Palette, Rocket, Terminal } from "lucide-react"; import type { LucideIcon } from "lucide-react"; import { Button } from "@ui-sdk/react/button"; import { Checkbox, CheckboxIndicator } from "@ui-sdk/react/checkbox"; import { Field, FieldDescription, FieldError, FieldLabel } from "@ui-sdk/react/field"; import { Input } from "@ui-sdk/react/input"; import { PasswordInput, PasswordInputControl, PasswordInputToggle, } from "@ui-sdk/react/password-input"; import { Radio, RadioGroup } from "@ui-sdk/react/radio"; const card = "rounded-2xl border border-[#d8e0ea] bg-white shadow-[0_18px_44px_rgba(15,23,42,0.12)] dark:border-slate-400/20 dark:bg-[#111827] dark:shadow-[0_24px_60px_rgba(0,0,0,0.5)]"; const labelCls = "block text-[13px] font-semibold leading-snug text-slate-800 dark:text-slate-200"; const hintCls = "text-xs leading-relaxed text-slate-600 dark:text-slate-400"; const errorCls = "text-xs font-semibold text-red-800 dark:text-red-300"; const fieldBase = "w-full min-w-0 rounded-[10px] border-[1.5px] border-slate-300 bg-white text-sm font-medium text-slate-900 shadow-[0_1px_2px_rgba(15,23,42,0.06)] outline-none transition-[border-color,box-shadow] hover:border-slate-400 focus:border-sky-600 focus:ring-[3px] focus:ring-sky-600/25 dark:border-slate-400/35 dark:bg-[#182234] dark:text-slate-50 dark:shadow-[inset_0_1px_2px_rgba(0,0,0,0.35)] dark:hover:border-slate-400/55 dark:focus:border-sky-400 dark:focus:ring-sky-400/30"; const inputCls = `${fieldBase} h-11 px-3.5`; const btnBase = "inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-[10px] font-bold transition hover:-translate-y-px active:translate-y-px disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-500"; const btnMd = "h-11 px-4 text-sm"; const btnPrimary = `${btnBase} border border-sky-300/60 bg-linear-to-b from-sky-300 via-sky-400 to-sky-600 text-[#031521] shadow-[inset_0_1px_0_rgba(255,255,255,0.55),inset_0_-2px_0_rgba(3,55,86,0.35),0_8px_20px_rgba(2,132,199,0.25)] hover:brightness-105`; export type SignupRole = "founder" | "designer" | "developer"; export interface SignupPayload { name: string; email: string; password: string; workspace: string; role: SignupRole; marketingOptIn: boolean; } export interface WorkspaceSignupFlowProps { appName?: string; /** Square brand mark shown above the heading. */ logoSrc?: string; signInHref?: string; /** Throw an Error to show its message above the submit button (email already in use…). */ onSignup?: (payload: SignupPayload) => Promise<void> | void; } const ROLES: { value: SignupRole; label: string; description: string; icon: LucideIcon }[] = [ { value: "founder", label: "Founder", description: "Running the product and the business.", icon: Rocket }, { value: "designer", label: "Designer", description: "Shaping screens, flows, and brand.", icon: Palette }, { value: "developer", label: "Developer", description: "Building and shipping the code.", icon: Terminal }, ]; type Status = "editing" | "submitting" | "created"; type Errors = { name?: string; email?: string; password?: string; form?: string }; export function WorkspaceSignupFlow({ appName = "Snow", logoSrc = "/brand/snow-icon-transparent.webp", signInHref = "/login", onSignup, }: WorkspaceSignupFlowProps) { const formRef = React.useRef<HTMLFormElement>(null); const [status, setStatus] = React.useState<Status>("editing"); const [name, setName] = React.useState(""); const [email, setEmail] = React.useState(""); const [workspace, setWorkspace] = React.useState(""); const [password, setPassword] = React.useState(""); const [role, setRole] = React.useState<SignupRole>("founder"); const [marketingOptIn, setMarketingOptIn] = React.useState(false); const [errors, setErrors] = React.useState<Errors>({}); const rules = [ { label: "8 or more characters", met: password.length >= 8 }, { label: "At least one number", met: /\d/.test(password) }, ]; const workspaceName = workspace.trim() || (name.trim() ? `${name.trim().split(/\s+/)[0]}’s workspace` : ""); const clearError = (key: keyof Errors) => { if (errors[key]) setErrors((prev) => ({ ...prev, [key]: undefined })); }; const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => { event.preventDefault(); if (status === "submitting") return; const next: Errors = {}; if (!name.trim()) next.name = "Enter your name."; if (!/^\S+@\S+\.\S+$/.test(email.trim())) next.email = "Enter a valid work email."; if (!rules.every((rule) => rule.met)) next.password = "Use 8 or more characters with at least one number."; if (next.name || next.email || next.password) { setErrors(next); requestAnimationFrame(() => { formRef.current?.querySelector<HTMLElement>('[aria-invalid="true"]')?.focus(); }); return; } setErrors({}); setStatus("submitting"); try { await onSignup?.({ name: name.trim(), email: email.trim(), password, workspace: workspaceName, role, marketingOptIn, }); setStatus("created"); } catch (error) { setErrors({ form: error instanceof Error && error.message ? error.message : "We couldn’t create your workspace. Try again.", }); setStatus("editing"); } }; const brand = ( <div className="flex items-center gap-2.5"> <img src={logoSrc} alt="" width={44} height={44} className="h-11 w-11 object-contain drop-shadow-[0_6px_14px_rgba(56,189,248,0.32)]" /> <span className="text-[15px] font-bold text-slate-900 dark:text-slate-50">{appName}</span> </div> ); if (status === "created") { return ( <div role="status" className={`${card} mx-auto w-full max-w-xl p-5 text-center sm:p-8`}> <div className="flex justify-center">{brand}</div> <div className="mx-auto mt-5 grid h-13 w-13 place-items-center rounded-2xl border border-emerald-600/40 bg-emerald-50 text-emerald-700 dark:border-emerald-400/40 dark:bg-emerald-400/15 dark:text-emerald-300"> <Check className="h-6 w-6" strokeWidth={2.5} aria-hidden="true" /> </div> <h1 className="mt-4 text-2xl font-bold tracking-tight text-slate-900 dark:text-slate-50">Your workspace is ready</h1> <p className="mt-1.5 text-sm text-slate-600 dark:text-slate-400"> <strong className="font-semibold text-slate-900 dark:text-slate-50">{workspaceName}</strong> is set up. We sent a confirmation to {email.trim()}. </p> </div> ); } return ( <form ref={formRef} onSubmit={handleSubmit} noValidate className={`${card} mx-auto w-full max-w-xl p-5 sm:p-8`}> {brand} <h1 className="mt-5 text-2xl font-bold tracking-tight text-balance text-slate-900 dark:text-slate-50"> Create your workspace </h1> <p className="mt-1.5 text-sm text-slate-600 dark:text-slate-400">Takes about a minute. No credit card needed.</p> <div className="mt-6 grid items-start gap-4 sm:grid-cols-2"> <Field name="name" invalid={Boolean(errors.name)} className="grid gap-1.5"> <FieldLabel className={labelCls}>Full name</FieldLabel> <Input required autoComplete="name" value={name} onValueChange={(value) => { setName(value); clearError("name"); }} className={inputCls} /> {errors.name && ( <FieldError match className={errorCls}> {errors.name} </FieldError> )} </Field> <Field name="email" invalid={Boolean(errors.email)} className="grid gap-1.5"> <FieldLabel className={labelCls}>Work email</FieldLabel> <Input type="email" required autoComplete="email" value={email} onValueChange={(value) => { setEmail(value); clearError("email"); }} className={inputCls} /> {errors.email ? ( <FieldError match className={errorCls}> {errors.email} </FieldError> ) : ( <FieldDescription className={hintCls}>We’ll send a code to confirm it.</FieldDescription> )} </Field> <Field name="workspace" className="grid gap-1.5"> <FieldLabel className={labelCls}>Workspace name</FieldLabel> <Input autoComplete="organization" value={workspace} onValueChange={setWorkspace} className={inputCls} /> <FieldDescription className={hintCls}>Optional. You can rename it any time.</FieldDescription> </Field> <Field name="password" invalid={Boolean(errors.password)} className="grid gap-1.5"> <FieldLabel className={labelCls}>Password</FieldLabel> <PasswordInput value={password} onValueChange={(value) => { setPassword(value); clearError("password"); }} required autoComplete="new-password" className="relative" > <PasswordInputControl className={`${inputCls} pr-12`} /> <PasswordInputToggle aria-label="Show password" className="absolute top-1.5 right-1.5 grid h-8 w-8 cursor-pointer place-items-center rounded-lg text-slate-600 transition hover:bg-slate-900/5 hover:text-slate-900 dark:text-slate-400 dark:hover:bg-slate-400/15 dark:hover:text-slate-50" > {(state) => state.visible ? ( <EyeOff className="h-4 w-4" aria-hidden="true" /> ) : ( <Eye className="h-4 w-4" aria-hidden="true" /> ) } </PasswordInputToggle> </PasswordInput> <ul aria-label="Password requirements" className="flex flex-wrap gap-x-4 gap-y-1"> {rules.map((rule) => ( <li key={rule.label} className={ rule.met ? "flex items-center gap-1.5 text-xs font-semibold text-emerald-700 dark:text-emerald-300" : "flex items-center gap-1.5 text-xs text-slate-600 dark:text-slate-400" } > {rule.met ? ( <Check className="h-3.5 w-3.5" strokeWidth={3} aria-hidden="true" /> ) : ( <Minus className="h-3.5 w-3.5" aria-hidden="true" /> )} <span className="sr-only">{rule.met ? "Done:" : "To do:"}</span> <span>{rule.label}</span> </li> ))} </ul> {errors.password && ( <FieldError match className={errorCls}> {errors.password} </FieldError> )} </Field> </div> <Field name="role" className="mt-5 grid gap-2"> <FieldLabel className={labelCls}>Your role</FieldLabel> <RadioGroup<SignupRole> value={role} onValueChange={(value) => { if (value) setRole(value); }} className="grid gap-2.5 sm:grid-cols-3" > {ROLES.map((option) => { const Icon = option.icon; return ( <Radio key={option.value} value={option.value} className="group flex cursor-pointer items-start gap-3 rounded-[10px] border-[1.5px] border-slate-300 bg-white p-3 text-left shadow-[0_1px_2px_rgba(15,23,42,0.06)] transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-500 data-checked:border-sky-700 data-checked:bg-sky-700 data-unchecked:hover:border-slate-400 dark:border-slate-400/35 dark:bg-[#182234] dark:data-checked:border-sky-400 dark:data-checked:bg-sky-400 dark:data-unchecked:hover:border-slate-400/55 sm:flex-col sm:gap-2" > <Icon className="mt-0.5 h-[18px] w-[18px] shrink-0 text-sky-700 group-data-checked:text-white dark:text-sky-300 dark:group-data-checked:text-[#031521]" aria-hidden="true" /> <span className="grid min-w-0 gap-0.5"> <span className="text-sm font-bold text-slate-900 group-data-checked:text-white dark:text-slate-50 dark:group-data-checked:text-[#031521]"> {option.label} </span> <span className="text-xs leading-snug text-slate-600 group-data-checked:text-white dark:text-slate-400 dark:group-data-checked:text-[#031521]"> {option.description} </span> </span> </Radio> ); })} </RadioGroup> </Field> <label className="mt-5 flex cursor-pointer items-start gap-3 text-[13px] leading-relaxed text-slate-700 dark:text-slate-300"> <Checkbox aria-label="Product tips and updates" checked={marketingOptIn} onCheckedChange={(checked) => setMarketingOptIn(checked === true)} className="mt-0.5 grid h-5 w-5 shrink-0 cursor-pointer place-items-center rounded-md border-[1.5px] border-slate-400 bg-white shadow-[0_1px_2px_rgba(15,23,42,0.06)] transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-500 data-checked:border-sky-700 data-checked:bg-sky-700 data-checked:text-white dark:border-slate-400/55 dark:bg-[#182234] dark:data-checked:border-sky-400 dark:data-checked:bg-sky-400 dark:data-checked:text-[#031521]" > <CheckboxIndicator> <Check className="h-3.5 w-3.5" strokeWidth={3} aria-hidden="true" /> </CheckboxIndicator> </Checkbox> <span>Send me product tips and updates. Optional, and you can unsubscribe any time.</span> </label> {errors.form && ( <p role="alert" className="mt-5 rounded-[10px] border border-red-300 bg-red-50 px-3.5 py-2.5 text-[13px] font-semibold text-red-800 dark:border-red-400/50 dark:bg-red-500/15 dark:text-red-200" > {errors.form} </p> )} <Button type="submit" disabled={status === "submitting"} data-agent-confirm="Creates your new account and workspace" className={`${btnPrimary} ${btnMd} mt-6 w-full`} > <span>{status === "submitting" ? "Creating your workspace…" : "Create workspace"}</span> <ArrowRight className="h-4 w-4" aria-hidden="true" /> </Button> <p className={`${hintCls} mt-4 text-center`}> Already have an account?{" "} <a href={signInHref} className="rounded font-semibold text-sky-700 hover:underline dark:text-sky-300"> Sign in </a> </p> </form> ); } export default WorkspaceSignupFlow;
More in Auth & Login
WynterHub SSO Sign-In Card
Centered high-trust sign-in card with your real brand mark, one prominent WynterHub single sign-on button, and a tucked-away email + password fallback with crisp readable inputs, show/hide password, inline validation, and a signed-in confirmation.
One-Time Code Verification Card
Six crisp verification cells with strong borders and an active sky glow, paste-the-whole-code support, a clear wrong-code error and success state, a resend button with a live cooldown, and readable fallback actions.