Animated Stepper
smoothui-registry/animated-stepperFreeComponent
Animated stepper/wizard component with step transitions
Install it
npx shadcn@latest add https://www.smoothui.dev/r/animated-stepper.jsonSource
1"use client";23import { cn } from "@/lib/utils";4import { AnimatePresence, motion, useReducedMotion } from "motion/react";5import { type ReactNode, useCallback, useId, useState } from "react";67export interface StepItem {8 content?: ReactNode;9 description?: string;10 icon?: ReactNode;11 label: string;12}1314export interface AnimatedStepperProps {15 allowClickNavigation?: boolean;16 className?: string;17 currentStep?: number;18 defaultStep?: number;19 onStepChange?: (step: number) => void;20 steps: StepItem[];21 variant?: "horizontal" | "vertical";22}2324/* ─────────────────────────────────────────────────────────25 * ANIMATION STORYBOARD26 *27 * 0ms stepper enters viewport28 * 100ms step circles stagger in (50ms each)29 * click active ring pulse + circle scale bounce30 * step progress line fills with spring31 * done checkmark draws with pathLength animation32 * slide content slides directionally with crossfade33 * ───────────────────────────────────────────────────────── */3435const SPRING = {36 bounce: 0.1,37 duration: 0.25,38 type: "spring" as const,39};4041const SPRING_BOUNCY = {42 bounce: 0.2,43 duration: 0.3,44 type: "spring" as const,45};4647function CheckIcon() {48 return (49 <svg50 aria-hidden="true"51 className="h-5 w-5"52 fill="none"53 stroke="currentColor"54 strokeWidth={2.5}55 viewBox="0 0 24 24"56 >57 <path d="M5 13l4 4L19 7" strokeLinecap="round" strokeLinejoin="round" />58 </svg>59 );60}6162export default function AnimatedStepper({63 steps,64 currentStep: controlledStep,65 defaultStep = 0,66 onStepChange,67 variant = "horizontal",68 allowClickNavigation = false,69 className,70}: AnimatedStepperProps) {71 const shouldReduceMotion = useReducedMotion();72 const id = useId();7374 const [internalStep, setInternalStep] = useState(defaultStep);75 const [direction, setDirection] = useState(1);7677 const isControlled = controlledStep !== undefined;78 const activeStep = isControlled ? controlledStep : internalStep;7980 const handleStepChange = useCallback(81 (step: number) => {82 if (step < 0 || step >= steps.length) {83 return;84 }85 setDirection(step > activeStep ? 1 : -1);86 if (!isControlled) {87 setInternalStep(step);88 }89 onStepChange?.(step);90 },91// … truncated
What it pulls in
npm packages
Files it writes
More from SmoothUI Registry
All 177 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Agent Avataragent-avatar | SmoothUI Registry | Components | Free | no deps | |
| Ai Approvalai-approval | SmoothUI Registry | Components | Free | 2 deps | |
| Ai Artifactai-artifact | SmoothUI Registry | Components | Free | 2 deps | |
| Ai Branchai-branch | SmoothUI Registry | Components | Free | 2 deps | |
| Ai Citationai-citation | SmoothUI Registry | Components | Free | 2 deps | |
| Ai Context Meterai-context-meter | SmoothUI Registry | Components | Free | 2 deps | |
| Ai Conversationai-conversation | SmoothUI Registry | Components | Free | 2 deps | |
| Ai Coreai-core | SmoothUI Registry | Components | Free | 1 dep |
