Multi Step Form
uselayouts/multi-step-formFreeComponent
A dynamic, animated multi-step form with validation.
Live preview
live · rendered by the registry
Rendered by uselayouts on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://uselayouts.com/r/multi-step-form.jsonSource
1"use client";23import React, { useState, useMemo } from "react";4import { format } from "date-fns";5import { Check, ChevronRight, ChevronLeft, CalendarIcon } from "lucide-react";6import { useForm, FormProvider as Form } from "react-hook-form";7import { zodResolver } from "@hookform/resolvers/zod";8import { z } from "zod";9import { toast } from "sonner";10import {11 Field,12 FieldLabel,13 FieldDescription,14 FieldError,15} from "@/components/ui/field";16import {17 Card,18 CardHeader,19 CardTitle,20 CardDescription,21 CardContent,22 CardFooter,23} from "@/components/ui/card";24import { Button } from "@/components/ui/button";25import { Input } from "@/components/ui/input";26import { Textarea } from "@/components/ui/textarea";27import {28 Select,29 SelectContent,30 SelectItem,31 SelectTrigger,32 SelectValue,33} from "@/components/ui/select";34import { Badge } from "@/components/ui/badge";35import { Calendar } from "@/components/ui/calendar";36import {37 Popover,38 PopoverContent,39 PopoverTrigger,40} from "@/components/ui/popover";41import { cn } from "@/lib/utils";42import { AnimatePresence, motion, MotionConfig } from "motion/react";43import useMeasure from "react-use-measure";4445const TEAM_SIZE_OPTIONS = [46 { label: "Select team size", value: null },47 { label: "1-5 Members", value: "1-5" },48 { label: "5-10 Members", value: "5-10" },49 { label: "10+ Members", value: "10+" },50];5152const PRIORITY_OPTIONS = [53 { label: "Select priority", value: null },54 { label: "Low", value: "Low" },55 { label: "Medium", value: "Medium" },56 { label: "High", value: "High" },57 { label: "Critical", value: "Critical" },58];5960const formSchema = z.object({61 "project-name": z.string().optional(),62 "due-date": z.date().optional(),63 description: z.string().optional(),64 "team-size": z.string().nullable().optional(),65 priority: z.string().nullable().optional(),66 tag: z.array(z.string()).optional(),67 mood: z.string().optional(),68 comment: z.string().optional(),69});7071type FormValues = z.infer<typeof formSchema>;7273export default function MultiStepFormDemo() {74 const [currentStep, setCurrentStep] = useState(0);75 const [direction, setDirection] = useState<number>();76 const [ref, bounds] = useMeasure();7778 const form = useForm<FormValues>({79 resolver: zodResolver(formSchema),80 defaultValues: {81 "project-name": "",82 "due-date": undefined,83 description: "",84 "team-size": null,85 priority: null,86 tag: [],87 mood: "",88 comment: "",89 },90 });9192// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from uselayouts
All 26 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| 3D Book3d-book | uselayouts | Components | Free | 3 deps | |
| Animated Collectionanimated-collection | uselayouts | Components | Free | 5 deps | |
| Bento Cardbento-card | uselayouts | Components | Free | 5 deps | |
| Bottom Menubottom-menu | uselayouts | Components | Free | 6 deps | |
| Bucketbucket | uselayouts | Components | Free | 5 deps · 2 files | |
| Day Pickerday-picker | uselayouts | Components | Free | 5 deps | |
| Delete Buttondelete-button | uselayouts | Components | Free | 5 deps | |
| Discover Buttondiscover-button | uselayouts | Components | Free | 5 deps |
