Skip to Content
zjkm-ui
Components

Floating Label Input

A text field whose label floats up as you type.

Props
<FloatingLabelInput label="Email address" />

Installation

npx shadcn@latest add https://ui.zjkm.tech/r/floating-label-input.json
import { 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

PropTypeDefaultDescription
labelstringThe label.
classNamestringClasses for the wrapper.
...propsinput propsEvery native <input> prop: name, required, onChange and so on.

With reduced motion, the label moves without a transition.

On this page