sltowl-merged

Stepper

Component

About

A numbered, multi-step progress indicator that shows a user's position in a checkout, setup, or onboarding flow, horizontally or vertically.

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

Code

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

Usage.tsx

"use client";

import { useState } from "react";
import { Button } from "@/components/ui/button";
import {
  Step,
  StepIndicator,
  StepLabel,
  StepSeparator,
  Stepper,
} from "@/components/ui/stepper";

const steps = ["Cart", "Shipping", "Payment", "Review"];

export default function StepperDemo() {
  const [step, setStep] = useState(1);

  return (
    <div className="flex w-full max-w-xl flex-col gap-6">
      <Stepper aria-label="Checkout" value={step}>
        {steps.map((label) => (
          <Step key={label}>
            <StepIndicator />
            <StepLabel className="sr-only sm:not-sr-only">{label}</StepLabel>
            <StepSeparator />
          </Step>
        ))}
      </Stepper>

      <div className="flex items-center justify-between gap-2">
        <Button
          disabled={step === 0}
          onClick={() => setStep((current) => current - 1)}
          variant="outline"
        >
          Back
        </Button>
        <Button
          disabled={step === steps.length - 1}
          onClick={() => setStep((current) => current + 1)}
        >
          Next
        </Button>
      </div>
    </div>
  );
}

Dependencies

More by sltowl-merged

View all
  • Search Input

    Search Input