Component

Floating Label Input

Material-inspired floating label inputs with smooth animations

  • Component
  • Tailwind
  • MIT

Preview

Live component

Interactive preview
Open preview
9:41 100%
devsnips.site/library/tailwind/components/input/floating-label/
fluid · no fixed width 100%
No dependencies Production-ready

Install

Add to your project

terminal
npx devsnips add Tailwind/Components/Input/floating-label
registry path: Tailwind/Components/Input/floating-label

Source

Implementation

code.html
<!-- Floating Label - Standard -->
<div class="relative">
  <input type="email" id="email-float" placeholder=" " class="peer w-full px-4 py-4 pt-6 pb-2 bg-white border border-gray-200 rounded-xl focus:outline-none focus:border-blue-500 focus:ring-2 focus:ring-blue-500/20 transition-all" />
  <label for="email-float" class="absolute left-4 top-4 text-gray-400 transition-all duration-200 pointer-events-none peer-placeholder-shown:top-4 peer-placeholder-shown:text-base peer-focus:top-2 peer-focus:text-xs peer-focus:text-blue-500 peer-focus:font-medium">Email Address</label>
</div>

<!-- Floating Label - With Value -->
<div class="relative mt-4">
  <input type="email" id="email-filled" placeholder=" " value="[email protected]" class="peer w-full px-4 py-4 pt-6 pb-2 bg-white border border-gray-200 rounded-xl focus:outline-none focus:border-blue-500 focus:ring-2 focus:ring-blue-500/20 transition-all" />
  <label for="email-filled" class="absolute left-4 top-2 text-xs text-blue-500 font-medium transition-all duration-200 pointer-events-none peer-placeholder-shown:top-4 peer-placeholder-shown:text-base">Email Address</label>
</div>

<!-- Floating Label - Password -->
<div class="relative mt-4">
  <input type="password" id="password-float" placeholder=" " class="peer w-full px-4 py-4 pt-6 pb-2 bg-white border border-gray-200 rounded-xl focus:outline-none focus:border-purple-500 focus:ring-2 focus:ring-purple-500/20 transition-all" />
  <label for="password-float" class="absolute left-4 top-4 text-gray-400 transition-all duration-200 pointer-events-none peer-placeholder-shown:top-4 peer-placeholder-shown:text-base peer-focus:top-2 peer-focus:text-xs peer-focus:text-purple-500 peer-focus:font-medium">Password</label>
</div>
17 lines UTF-8 · LF · Spaces: 2
DevSnips AI ready Claude · Cursor · Windsurf

Agent skill & Model Context Protocol

Pass this component straight into your AI workflow. DevSnips exposes each resource as a structured, addressable registry entry, so your agent installs the real files instead of approximating them.

devsnips://components/input/floating-label
Prompt instruction
I want to use this DevSnips resource in production:

Page:
https://devsnips.site/library/tailwind/components/input/floating-label/

Install: npx devsnips add
Tailwind/Components/Input/floating-label

This is the Floating Label Input — Material-inspired floating label inputs with smooth animations

Use this DevSnips resource as the starting point for my project.
Adapt it to my project's stack and conventions, fix any issues,
and make it production-ready while preserving its intended design
and behavior.

Paste into ChatGPT, Claude or your agent — it already carries the page URL and the exact install path.

Resource URI
devsnips://components/input/floating-label