Component

Underline Input

Minimal underline style input fields with floating labels that animate on focus

  • Component
  • Tailwind
  • MIT

Preview

Live component

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

Install

Add to your project

terminal
npx devsnips add Tailwind/Components/Input/underline
registry path: Tailwind/Components/Input/underline

Source

Implementation

code.html
<!-- Underline Input - Default -->
<div class="relative">
  <input type="text" placeholder=" " class="peer w-full px-0 py-3 bg-transparent border-0 border-b-2 border-gray-300 rounded-none focus:outline-none focus:border-blue-600 placeholder-transparent peer-focus:placeholder-transparent" />
  <label class="absolute left-0 -top-3.5 text-sm text-gray-600 transition-all pointer-events-none peer-placeholder-shown:top-3 peer-placeholder-shown:text-base peer-focus:-top-3.5 peer-focus:text-sm">Email address</label>
</div>

<!-- Underline Input - With Value -->
<div class="relative mt-6">
  <input type="text" value="john.doe@example.com" class="peer w-full px-0 py-3 bg-transparent border-0 border-b-2 border-gray-300 rounded-none focus:outline-none focus:border-blue-600 placeholder-transparent peer-focus:placeholder-transparent" />
  <label class="absolute left-0 -top-3.5 text-sm text-gray-600 transition-all pointer-events-none peer-placeholder-shown:top-3 peer-placeholder-shown:text-base peer-focus:-top-3.5 peer-focus:text-sm">Email address</label>
</div>

<!-- Underline Input - Dark Variant -->
<div class="relative mt-6 bg-gray-900 p-4 rounded-lg">
  <input type="text" placeholder=" " class="peer w-full px-0 py-3 bg-transparent border-0 border-b-2 border-gray-500 text-white rounded-none focus:outline-none focus:border-blue-400 placeholder-transparent peer-focus:placeholder-transparent" />
  <label class="absolute left-0 -top-3.5 text-sm text-gray-400 transition-all pointer-events-none peer-placeholder-shown:top-3 peer-placeholder-shown:text-base peer-focus:-top-3.5 peer-focus:text-sm">Dark mode input</label>
</div>
17 lines UTF-8 · LF · Spaces: 2

AI-ready

Available to your agent.

This component is reachable through the DevSnips CLI, MCP server and Skills integrations — one registry, one resource path.

Resource path

devsnips://components/input/underline

Continue browsing

View all