niceui

Floating Input

A text input whose label floats above the value on focus. Pure CSS peer states, no JavaScript needed for the animation.

ReactTailwind CSSTypeScriptFormsMIT · Free

Installation

01

Install with the shadcn CLI.

$ npx shadcn@latest add https://niceui.dev/r/floating-input.json
02

Or copy the source manually into components/ui/floating-input.tsx. No extra dependencies.

Usage

import { FloatingInput } from "@/components/ui/floating-input";

export default function Example() {
  return <FloatingInput label="Email address" type="email" />;
}

For AI assistants

This page is also available as Markdown and as a shadcn registry item. Use Copy prompt to hand the full source to Claude, Cursor or v0.