Floating Label Input

React floating label input and textarea where the label springs from inside the field onto the top border on focus or fill, with helper text, error state and leading icon.

src/registry/ui/floating-label-input.tsx/r/floating-label-input.json

Installation#

bash
npx shadcn@latest add https://ui.minidev.pro/r/floating-label-input.json

Usage#

tsx
import { FloatingLabelInput } from "@/components/ui/floating-label-input"

export function Example() {
  return <FloatingLabelInput />
}

API reference#

FloatingLabelInput props
PropTypeDefault
labelstring-
multilinebooleanfalse
rowsnumber4
typestring"text"
valuestring-
defaultValuestring""
onChange(value: string) => void-
iconReact.ReactNode-
hintReact.ReactNode-
errorReact.ReactNode-
disabledbooleanfalse
requiredbooleanfalse
idstring-
namestring-
autoCompletestring-
fieldsFloatingLabelField[]FIELDS
onSubmit(values: Record<string, string>) => void-
classNamestring-

Dependencies#

npm

lucide-reactmotion

Built from

All form components