Components
Floating Label Input
A text field whose label floats up as you type.
<FloatingLabelInput label="Email address" />Installation
npx shadcn@latest add https://ui.zjkm.tech/r/floating-label-input.jsonimport { FloatingLabelInput } from "@/components/floating-label-input"Using JavaScript? Set tsx: false in components.json and the CLI converts it.
New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.
Usage
The label sits inside the field like a placeholder, then floats up and shrinks when you focus or type. It's a real <label>, so it names the field for screen readers even while it looks like a placeholder.
import { FloatingLabelInput } from "@/components/floating-label-input";
export function SignUp() {
return <FloatingLabelInput label="Email address" type="email" name="email" required />;
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | The label. | |
className | string | Classes for the wrapper. | |
...props | input props | Every native <input> prop: name, required, onChange and so on. |
With reduced motion, the label moves without a transition.