{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "input25",
  "title": "Input",
  "description": "Input built with shadcn/ui.",
  "dependencies": [
    "lucide-react@0"
  ],
  "registryDependencies": [
    "badge",
    "button",
    "input-group",
    "label"
  ],
  "files": [
    {
      "path": "contents/components/input/25/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 { InputGroup, InputGroupInput } from \"@/components/ui/input-group\";\nimport { Label } from \"@/components/ui/label\";\n\nconst initialTags = [\"Red\"];\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    } else if (e.key === \"Backspace\" && !value && tags.length) {\n      setTags(tags.slice(0, -1));\n    }\n  };\n\n  return (\n    <div className=\"w-full max-w-sm space-y-2\">\n      <Label htmlFor={id}>Input with inner tags</Label>\n      <InputGroup className=\"h-auto min-h-9 flex-wrap gap-1 p-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        <InputGroupInput\n          id={id}\n          value={value}\n          onChange={(e) => setValue(e.target.value)}\n          onKeyDown={onKeyDown}\n          placeholder=\"Add a tag\"\n          className=\"h-7 min-w-20 px-2\"\n        />\n      </InputGroup>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/input25.tsx"
    }
  ],
  "type": "registry:component"
}