Input Floating Label
Text fields whose label rests as a placeholder, then springs up into a small caption on focus or when filled; inset and underline variants.
inputlabelfloatingformfocus
Installation
Run the shadcn CLI in a project with Tailwind CSS. The component lands in components/pixelpapa/input-floating-label.tsx.
$pnpm dlx shadcn@latest add "https://pixelpapa.com/r/input-floating-label.json"Manual install+
1. Install the dependencies.
$pnpm add lucide-react2. Copy the code from the Code tab above into your project. It imports the cn helper from @/lib/utils, which every shadcn project already has.
Build it with AI
Prefer to let an agent do the wiring? Copy this prompt, describe where the component should go, and paste.
AI prompt
Paste into Claude, Cursor, v0 or Lovable
Add the "Input Floating Label" component from PixelPapa UI to this project. What it is: Text fields whose label rests as a placeholder, then springs up into a small caption on focus or when filled; inset and underline variants. Category: Inputs. Depends on: lucide-react. 1. Install it with the shadcn CLI: npx shadcn@latest add "https://pixelpapa.com/r/input-floating-label.json" (If the CLI is unavailable, fetch that URL, write files[0].content to components/pixelpapa/input-floating-label.tsx and install the listed dependencies.) 2. Import it from "@/components/pixelpapa/input-floating-label" and place it where I describe below. 3. Keep its animation timings and accessibility attributes. Replace the demo copy and data with content that fits my product, and use my existing theme tokens (bg-background, text-foreground, bg-primary, border-border) rather than hard-coded colours. Where to use it: <describe the page and position here>
More inputs
- Input Credit CardA payment form with a live card preview: digits group in fours, a highlight glides to the part you are editing, and the card flips over for the security code.
- Input Currency FormatA large amount field that groups thousands as you type without losing the caret, pads cents on blur, and grows to hug its digits.
- Input Inline EditText that turns into a field in place with no layout shift; Enter or blur saves with a brief tick, Escape puts the old value back.
- Input Mention AutocompleteA comment box that opens a people list when you type @, filters as you go, inserts the handle with Enter or Tab and tints finished mentions inline.
- Input Number StepperA spinbutton whose digits roll up or down like an odometer; hold a button to repeat with acceleration, or use the arrow keys.
- Input OTP BoxesOne-time-code boxes that auto-advance, accept a pasted code, step back on Backspace, pop each digit in and shake or hop on error or success.