{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "floating-label-input",
  "title": "Floating Label Input",
  "author": "VenusUI",
  "description": "A text field whose label sits inside and floats above on focus or when filled.",
  "files": [
    {
      "path": "registry/default/ui/floating-label-input.tsx",
      "content": "import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\ninterface FloatingLabelInputProps extends Omit<React.ComponentProps<\"input\">, \"placeholder\"> {\n  /** Visible label. It sits inside the field and floats up on focus or when filled. */\n  label: string\n}\n\n/**\n * A text input whose label starts inside the field and moves above the text\n * when the field is focused or has a value. Uses a real `<label>`, so it is\n * announced correctly and clicking it focuses the input. CSS only.\n */\nfunction FloatingLabelInput({ label, id, className, ...props }: FloatingLabelInputProps) {\n  const generatedId = React.useId()\n  const inputId = id ?? generatedId\n\n  return (\n    <div data-slot=\"floating-label-input\" className={cn(\"relative w-full\", className)}>\n      <input\n        id={inputId}\n        // A blank placeholder lets CSS know when the field is empty (:placeholder-shown).\n        placeholder=\" \"\n        className={cn(\n          \"peer h-12 w-full rounded-lg border bg-transparent px-3 pt-4 text-sm outline-none transition-colors\",\n          \"focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50\",\n          \"aria-invalid:border-destructive disabled:cursor-not-allowed disabled:opacity-50\"\n        )}\n        {...props}\n      />\n      <label\n        htmlFor={inputId}\n        className={cn(\n          \"pointer-events-none absolute top-1.5 left-3 origin-left text-xs text-muted-foreground transition-all duration-150 motion-reduce:transition-none\",\n          \"peer-placeholder-shown:top-1/2 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:text-sm\",\n          \"peer-focus:top-1.5 peer-focus:translate-y-0 peer-focus:text-xs peer-focus:text-foreground\"\n        )}\n      >\n        {label}\n      </label>\n    </div>\n  )\n}\n\nexport { FloatingLabelInput, type FloatingLabelInputProps }\n",
      "type": "registry:ui"
    }
  ],
  "meta": {
    "version": "0.1.0"
  },
  "categories": [
    "inputs",
    "forms"
  ],
  "type": "registry:ui"
}