{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "quantity-stepper",
  "type": "registry:ui",
  "title": "Quantity stepper",
  "description": "React quantity stepper with minus and plus buttons around a tabular count. Clamps to min and max, disables at the limits, and works controlled or uncontrolled.",
  "dependencies": [],
  "registryDependencies": [
    "https://ui.minidev.pro/r/button.json",
    "utils"
  ],
  "files": [
    {
      "path": "registry/ui/quantity-stepper.tsx",
      "type": "registry:ui",
      "target": "components/ui/quantity-stepper.tsx",
      "content": "\"use client\"\nimport * as React from \"react\"\nimport { Button } from \"@/components/ui/button\"\nimport { cn } from \"@/lib/utils\"\n\nfunction QuantityStepper({\n  value,\n  defaultValue = 1,\n  min = 1,\n  max = 99,\n  onChange,\n  className,\n}: {\n  value?: number\n  defaultValue?: number\n  min?: number\n  max?: number\n  onChange?: (n: number) => void\n  className?: string\n}) {\n  const [inner, setInner] = React.useState(defaultValue)\n  const n = value ?? inner\n  const set = (next: number) => {\n    const v = Math.min(max, Math.max(min, next))\n    onChange?.(v)\n    if (value === undefined) setInner(v)\n  }\n  return (\n    <div data-slot=\"quantity-stepper\" className={cn(\"inline-flex items-center gap-1 rounded-lg border border-border bg-surface p-1\", className)}>\n      <Button type=\"button\" size=\"icon-sm\" variant=\"ghost\" aria-label=\"Decrease\" onClick={() => set(n - 1)} disabled={n <= min}>−</Button>\n      <span className=\"min-w-8 text-center font-mono text-sm tabular-nums text-fg\">{n}</span>\n      <Button type=\"button\" size=\"icon-sm\" variant=\"ghost\" aria-label=\"Increase\" onClick={() => set(n + 1)} disabled={n >= max}>+</Button>\n    </div>\n  )\n}\nexport { QuantityStepper }\n"
    }
  ]
}
