UIKit v2.0
stable v2.0

Input

Text input field with label, helper text, error state, and icon support.

Preview

We'll never share your email.
Password must be at least 8 characters.

Code

<!-- Default -->
<div class="flex flex-col gap-1.5">
  <label class="text-sm font-medium text-neutral-700 dark:text-neutral-300">Email</label>
  <input type="email" placeholder="you@example.com"
    class="h-10 px-3 rounded-lg border border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-900 text-sm placeholder:text-neutral-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition"/>
  <span class="text-xs text-neutral-500">We'll never share your email.</span>
</div>

<!-- With left icon -->
<div class="flex flex-col gap-1.5">
  <label class="text-sm font-medium text-neutral-700 dark:text-neutral-300">Search</label>
  <div class="relative">
    <svg class="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-neutral-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
      <circle cx="11" cy="11" r="8"/><path stroke-linecap="round" d="M21 21l-4.35-4.35"/>
    </svg>
    <input type="text" placeholder="Search..."
      class="h-10 pl-9 pr-3 w-full rounded-lg border border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-900 text-sm placeholder:text-neutral-400 focus:outline-none focus:ring-2 focus:ring-blue-500 transition"/>
  </div>
</div>

<!-- Error state -->
<div class="flex flex-col gap-1.5">
  <label class="text-sm font-medium text-neutral-700 dark:text-neutral-300">Password</label>
  <input type="password" value="short"
    class="h-10 px-3 rounded-lg border border-red-500 bg-white dark:bg-neutral-900 text-sm focus:outline-none focus:ring-2 focus:ring-red-500 transition"/>
  <span class="text-xs text-red-600 dark:text-red-400">Password must be at least 8 characters.</span>
</div>

<!-- Disabled -->
<div class="flex flex-col gap-1.5">
  <label class="text-sm font-medium text-neutral-400">Disabled Input</label>
  <input type="text" disabled value="Cannot edit this"
    class="h-10 px-3 rounded-lg border border-neutral-200 dark:border-neutral-800 bg-neutral-50 dark:bg-neutral-900 text-sm text-neutral-400 cursor-not-allowed"/>
</div>

API Reference

PropTypeDefaultDescription
typestring'text'HTML input type
labelstringLabel text above the input
placeholderstringPlaceholder text
errorstringError message shown below input
disabledbooleanfalseDisables the input
leftIconReactNodeIcon inside left edge