{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "input24",
  "title": "Input",
  "description": "Input built with shadcn/ui.",
  "dependencies": [
    "lucide-react@0"
  ],
  "registryDependencies": [
    "badge",
    "button",
    "input",
    "label"
  ],
  "files": [
    {
      "path": "contents/components/input/24/index.tsx",
      "content": "\"use client\";\n\nimport { XIcon } from \"lucide-react\";\nimport { useId, useState, type KeyboardEvent } from \"react\";\n\nimport { Badge } from \"@/components/ui/badge\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\n\nconst initialTags = [\"Sport\", \"Coding\", \"Travel\"];\n\nexport default function Component() {\n  const id = useId();\n  const [tags, setTags] = useState(initialTags);\n  const [value, setValue] = useState(\"\");\n\n  const addTag = () => {\n    const tag = value.trim();\n    if (tag && !tags.includes(tag)) setTags([...tags, tag]);\n    setValue(\"\");\n  };\n\n  const removeTag = (tag: string) => setTags(tags.filter((t) => t !== tag));\n\n  const onKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n    if (e.key === \"Enter\" || e.key === \",\") {\n      e.preventDefault();\n      addTag();\n    }\n  };\n\n  return (\n    <div className=\"w-full max-w-sm space-y-2\">\n      <Label htmlFor={id}>Input with tags</Label>\n      <Input\n        id={id}\n        value={value}\n        onChange={(e) => setValue(e.target.value)}\n        onKeyDown={onKeyDown}\n        placeholder=\"Add a tag\"\n      />\n      {tags.length > 0 && (\n        <div className=\"flex flex-wrap gap-1\">\n          {tags.map((tag) => (\n            <Badge key={tag} variant=\"outline\" className=\"h-7 pe-0.5\">\n              {tag}\n              <Button\n                variant=\"ghost\"\n                size=\"icon-xs\"\n                className=\"text-muted-foreground hover:text-foreground\"\n                onClick={() => removeTag(tag)}\n                aria-label={`Remove ${tag}`}\n              >\n                <XIcon />\n              </Button>\n            </Badge>\n          ))}\n        </div>\n      )}\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/input24.tsx"
    }
  ],
  "type": "registry:component"
}