ham7a311

Progressive Form

Forms 2

About

A one-question-at-a-time multi-step form that writes every answer into a running sentence above the field, inking each answer in as you confirm it until the sentence becomes the final review.

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

Code

How Progressive Form is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import {
  ProgressiveForm,
  useToday,
  type Step,
} from "@/components/ui/progressive-form";

const fmtDate = (v: string) => {
  const d = new Date(`${v}T00:00:00`);
  return Number.isNaN(d.getTime())
    ? v
    : d.toLocaleDateString("en-GB", { day: "numeric", month: "long" });
};

export default function ProgressiveFormDemo() {
  const today = useToday();

  const steps: Step[] = [
    {
      id: "name",
      name: "Your name",
      label: "First, what should we call you?",
      type: "text",
      placeholder: "Jamie Rivera",
      validate: (v) =>
        v.trim().length < 2 ? "A name needs at least two letters." : null,
    },
    {
      id: "org",
      name: "Organisation",
      label: "Where do you work or study?",
      type: "text",
      placeholder: "Acme Co",
      hint: "This becomes your workspace name. You can change it later.",
    },
    {
      id: "size",
      name: "Team size",
      label: "How many people will use it?",
      type: "number",
      placeholder: "12",
      min: 1,
      max: 500,
      summary: (v) => (v === "1" ? "one" : v),
    },
    {
      id: "plan",
      name: "Plan",
      label: "Which plan would you like to start on?",
      type: "choice",
      summary: (v) =>
        ({ free: "the Free plan", pro: "the Pro plan", team: "the Team plan" })[
          v
        ] ?? v,
      options: [
        { value: "free", label: "Free", description: "Up to 3 projects" },
        {
          value: "pro",
          label: "Pro",
          description: "$6 / seat · unlimited projects",
        },
        {
          value: "team",
          label: "Team",
          description: "$11 / seat · SSO and audit log",
        },
        {
          value: "ent",
          label: "Enterprise",
          description: "Talk to sales — not available for self-serve",
          disabled: true,
        },
      ],
    },
    {
      id: "start",
      name: "Start date",
      label: "When should billing start?",
      type: "date",
      hint: "Your 14-day trial runs until then.",
      summary: fmtDate,
      validate: (v) =>
        today && v < today ? "Pick today or a date after it." : null,
    },
  ];

  return (
    <div className="flex h-full min-h-[600px] w-full items-center justify-center bg-background px-5 py-10 text-foreground">
      <ProgressiveForm
        theme="paper"
        title="Set up your workspace"
        steps={steps}
        submitLabel="Create workspace"
        successMessage="Workspace created — see you inside."
        onSubmit={() => new Promise((r) => setTimeout(r, 1200))}
        template={(t) => (
          <>
            I&rsquo;m {t("name")} from {t("org")}, a team of {t("size")}, and
            we&rsquo;d like to start on {t("plan")} from {t("start")}.
          </>
        )}
      />
    </div>
  );
}

More by ham7a311

View all
  • Wave Mesh

    Wave Mesh

    249
  • Route Globe

    Route Globe

    195
  • Glass Tiles

    Glass Tiles

    183
  • Orbit Ring Stats

    Orbit Ring Stats

    82
  • Glyph Swell

    Glyph Swell

    76
  • Fan Deck Card

    Fan Deck Card

    73
  • Ask Bar

    Ask Bar

    63
  • Glass Ribbons

    Glass Ribbons

    53

More in Forms

View all
  • Form

    Form

    7
  • Contact Form

    Contact Form

    31
  • Contact Card

    Contact Card

    1.1K
  • Book A Demo 1

    Book A Demo 1

    94
  • Premium Auth

    Premium Auth

    611
  • Input

    Input

    34
  • Form

    Form

    18
  • Paper Plane

    Paper Plane

    76