{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "progress-bar",
  "type": "registry:component",
  "title": "Progress Bar Stepper",
  "description": "A single progress bar that fills as the user advances.",
  "author": "Stepperize",
  "dependencies": [
    "@stepperize/react"
  ],
  "registryDependencies": [],
  "categories": [
    "layouts"
  ],
  "meta": {
    "capabilities": [
      "navigation"
    ],
    "level": "beginner",
    "tags": [
      "progress bar",
      "linear",
      "minimal",
      "header"
    ]
  },
  "files": [
    {
      "path": "components/stepperize/progress-bar.tsx",
      "type": "registry:component",
      "target": "components/stepperize/progress-bar.tsx",
      "content": "\"use client\";\n\nimport { defineStepper } from \"@stepperize/react\";\nimport { useState } from \"react\";\n\nconst { Stepper } = defineStepper([\n\t{ id: \"details\", title: \"Your details\" },\n\t{ id: \"address\", title: \"Address\" },\n\t{ id: \"payment\", title: \"Payment\" },\n\t{ id: \"review\", title: \"Review\" },\n]);\n\nexport function ProgressBarBlock() {\n\tconst [submitted, setSubmitted] = useState(false);\n\n\treturn (\n\t\t<Stepper.Root\n\t\t\tlinear\n\t\t\tclassName=\"w-full max-w-md rounded-xl border bg-background p-6 shadow-sm\"\n\t\t>\n\t\t\t{({ stepper }) => {\n\t\t\t\tconst progress = Math.round(\n\t\t\t\t\t((stepper.index + 1) / stepper.count) * 100,\n\t\t\t\t);\n\t\t\t\treturn (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<div className=\"mb-2 flex items-center justify-between text-sm\">\n\t\t\t\t\t\t\t<span className=\"font-medium\">{stepper.current.title}</span>\n\t\t\t\t\t\t\t<span className=\"text-muted-foreground\">\n\t\t\t\t\t\t\t\tStep {stepper.index + 1} of {stepper.count}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"h-2 w-full overflow-hidden rounded-full bg-muted\">\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName=\"h-full rounded-full bg-primary transition-all duration-300\"\n\t\t\t\t\t\t\t\tstyle={{ width: `${progress}%` }}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div className=\"mt-6 grid min-h-24 place-items-center rounded-lg border bg-muted/30 p-4 text-center text-sm text-muted-foreground\">\n\t\t\t\t\t\t\t{submitted ? (\n\t\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t\t<p className=\"font-medium text-foreground\">Form submitted</p>\n\t\t\t\t\t\t\t\t\t<p className=\"mt-1 text-xs\">\n\t\t\t\t\t\t\t\t\t\tYour details are ready for review.\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Stepper.Content step={stepper.current.id}>\n\t\t\t\t\t\t\t\t\t“{stepper.current.title}” fields go here.\n\t\t\t\t\t\t\t\t</Stepper.Content>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<Stepper.Actions className=\"mt-6 flex justify-between\">\n\t\t\t\t\t\t\t<Stepper.Prev className=\"inline-flex h-9 items-center rounded-lg border bg-background px-4 text-sm font-medium transition-colors hover:bg-muted disabled:pointer-events-none disabled:opacity-50\">\n\t\t\t\t\t\t\t\tBack\n\t\t\t\t\t\t\t</Stepper.Prev>\n\t\t\t\t\t\t\t{submitted ? (\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\tsetSubmitted(false);\n\t\t\t\t\t\t\t\t\t\tstepper.reset();\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tclassName=\"inline-flex h-9 items-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\tRestart flow\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t) : stepper.isLast ? (\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\tonClick={() => setSubmitted(true)}\n\t\t\t\t\t\t\t\t\tclassName=\"inline-flex h-9 items-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\tSubmit form\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Stepper.Next className=\"inline-flex h-9 items-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90\">\n\t\t\t\t\t\t\t\t\tContinue\n\t\t\t\t\t\t\t\t</Stepper.Next>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Stepper.Actions>\n\t\t\t\t\t</>\n\t\t\t\t);\n\t\t\t}}\n\t\t</Stepper.Root>\n\t);\n}\n\nexport default ProgressBarBlock;\n"
    }
  ]
}
