# Form Components
> Form patterns: login, signup, contact, search bar, multi-step wizard, and settings panel
> 폼 패턴: 로그인, 회원가입, 문의, 검색바, 멀티스텝 마법사, 설정 패널

**Category**: Components | **Tags**: forms, login, signup, wizard, validation, tailwind | **Difficulty**: Beginner

## Preview
```
+----------+  +----------+  +----------+
|  Login   |  |  Signup  |  | Contact  |
| [email]  |  | [name]   |  | [name]   |
| [pass]   |  | [email]  |  | [email]  |
| [Submit] |  | [pass]   |  | [msg]    |
+----------+  | [Submit] |  | [Send]   |
              +----------+  +----------+
+------- Multi-step Wizard --------+
| Step 1 > Step 2 > Step 3         |
| [fields...]          [Next ->]   |
+----------------------------------+
```

## Quick Start
```bash
# 1. Copy the form you need from the code below
# 2. Replace action URLs with your API endpoints
# 3. All forms include built-in HTML5 validation (required, type, pattern)
```

## Full Code

```html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Form Components</title>
  <script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gray-100 dark:bg-gray-900 p-8 min-h-screen">
  <div class="max-w-6xl mx-auto space-y-16">

    <h1 class="text-2xl font-bold text-gray-900 dark:text-white">Form Components</h1>

    <div class="grid md:grid-cols-2 lg:grid-cols-3 gap-8">

      <!-- 1. Login Form -->
      <div class="bg-white dark:bg-gray-800 rounded-2xl p-8 border border-gray-200 dark:border-gray-700 shadow-sm">
        <h2 class="text-xl font-bold text-center text-gray-900 dark:text-white mb-6">Welcome Back</h2>
        <form class="space-y-4" action="/api/login" method="POST">
          <div>
            <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Email</label>
            <input type="email" name="email" required placeholder="you@example.com" class="w-full px-4 py-2.5 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent">
          </div>
          <div>
            <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Password</label>
            <input type="password" name="password" required minlength="8" placeholder="Min 8 characters" class="w-full px-4 py-2.5 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent">
          </div>
          <div class="flex items-center justify-between">
            <label class="flex items-center gap-2 text-sm text-gray-500"><input type="checkbox" class="rounded"> Remember me</label>
            <a href="#" class="text-sm text-indigo-600 hover:underline">Forgot password?</a>
          </div>
          <button type="submit" class="w-full py-2.5 bg-indigo-600 text-white rounded-xl font-semibold hover:bg-indigo-700 transition">Sign In</button>
          <div class="relative my-4"><div class="absolute inset-0 flex items-center"><div class="w-full border-t border-gray-200 dark:border-gray-700"></div></div><div class="relative flex justify-center"><span class="bg-white dark:bg-gray-800 px-3 text-xs text-gray-400">or continue with</span></div></div>
          <div class="flex gap-3">
            <button type="button" class="flex-1 py-2 border border-gray-200 dark:border-gray-700 rounded-xl text-sm font-medium hover:bg-gray-50 dark:hover:bg-gray-700 transition">Google</button>
            <button type="button" class="flex-1 py-2 border border-gray-200 dark:border-gray-700 rounded-xl text-sm font-medium hover:bg-gray-50 dark:hover:bg-gray-700 transition">GitHub</button>
          </div>
        </form>
      </div>

      <!-- 2. Signup Form -->
      <div class="bg-white dark:bg-gray-800 rounded-2xl p-8 border border-gray-200 dark:border-gray-700 shadow-sm">
        <h2 class="text-xl font-bold text-center text-gray-900 dark:text-white mb-6">Create Account</h2>
        <form class="space-y-4" action="/api/signup" method="POST">
          <div class="grid grid-cols-2 gap-3">
            <div><label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">First</label><input type="text" name="first_name" required class="w-full px-3 py-2.5 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500"></div>
            <div><label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Last</label><input type="text" name="last_name" required class="w-full px-3 py-2.5 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500"></div>
          </div>
          <div><label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Email</label><input type="email" name="email" required class="w-full px-4 py-2.5 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500"></div>
          <div><label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Password</label><input type="password" name="password" required minlength="8" pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" title="Must contain: 8+ chars, uppercase, lowercase, number" class="w-full px-4 py-2.5 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500"></div>
          <label class="flex items-start gap-2 text-sm text-gray-500"><input type="checkbox" required class="rounded mt-0.5"> I agree to the <a href="#" class="text-indigo-600 hover:underline">Terms</a> and <a href="#" class="text-indigo-600 hover:underline">Privacy Policy</a></label>
          <button type="submit" class="w-full py-2.5 bg-indigo-600 text-white rounded-xl font-semibold hover:bg-indigo-700 transition">Create Account</button>
        </form>
      </div>

      <!-- 3. Contact Form -->
      <div class="bg-white dark:bg-gray-800 rounded-2xl p-8 border border-gray-200 dark:border-gray-700 shadow-sm">
        <h2 class="text-xl font-bold text-center text-gray-900 dark:text-white mb-6">Contact Us</h2>
        <form class="space-y-4" action="https://formspree.io/f/YOUR_ID" method="POST">
          <div><label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Name</label><input type="text" name="name" required class="w-full px-4 py-2.5 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500"></div>
          <div><label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Email</label><input type="email" name="email" required class="w-full px-4 py-2.5 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500"></div>
          <div>
            <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Subject</label>
            <select name="subject" class="w-full px-4 py-2.5 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500">
              <option>General Inquiry</option><option>Bug Report</option><option>Feature Request</option><option>Partnership</option>
            </select>
          </div>
          <div><label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Message</label><textarea name="message" rows="4" required class="w-full px-4 py-2.5 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 resize-none"></textarea></div>
          <button type="submit" class="w-full py-2.5 bg-indigo-600 text-white rounded-xl font-semibold hover:bg-indigo-700 transition">Send Message</button>
        </form>
      </div>

    </div>

    <!-- 4. Search Bar -->
    <div>
      <h2 class="text-lg font-bold text-gray-900 dark:text-white mb-4">Search Bar</h2>
      <div class="max-w-2xl">
        <div class="relative">
          <svg class="absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/></svg>
          <input type="search" placeholder="Search anything... (Ctrl+K)" class="w-full pl-12 pr-20 py-3 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-2xl text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 shadow-sm">
          <kbd class="absolute right-4 top-1/2 -translate-y-1/2 px-2 py-0.5 bg-gray-100 dark:bg-gray-700 text-xs text-gray-400 rounded border border-gray-200 dark:border-gray-600 font-mono">Ctrl K</kbd>
        </div>
      </div>
    </div>

    <!-- 5. Multi-Step Wizard -->
    <div>
      <h2 class="text-lg font-bold text-gray-900 dark:text-white mb-4">Multi-Step Wizard</h2>
      <div class="max-w-lg bg-white dark:bg-gray-800 rounded-2xl p-8 border border-gray-200 dark:border-gray-700 shadow-sm">
        <!-- Step Indicator -->
        <div class="flex items-center justify-between mb-8">
          <div class="flex items-center gap-2"><div class="w-8 h-8 bg-indigo-600 text-white rounded-full flex items-center justify-center text-sm font-bold">1</div><span class="text-sm font-medium text-gray-900 dark:text-white hidden sm:inline">Account</span></div>
          <div class="flex-1 h-0.5 mx-3 bg-gray-200 dark:bg-gray-700"></div>
          <div class="flex items-center gap-2"><div class="w-8 h-8 bg-gray-200 dark:bg-gray-700 text-gray-500 rounded-full flex items-center justify-center text-sm font-bold">2</div><span class="text-sm text-gray-400 hidden sm:inline">Profile</span></div>
          <div class="flex-1 h-0.5 mx-3 bg-gray-200 dark:bg-gray-700"></div>
          <div class="flex items-center gap-2"><div class="w-8 h-8 bg-gray-200 dark:bg-gray-700 text-gray-500 rounded-full flex items-center justify-center text-sm font-bold">3</div><span class="text-sm text-gray-400 hidden sm:inline">Confirm</span></div>
        </div>
        <!-- Step 1 Content -->
        <div class="space-y-4">
          <div><label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Email</label><input type="email" required class="w-full px-4 py-2.5 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500"></div>
          <div><label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Password</label><input type="password" required class="w-full px-4 py-2.5 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500"></div>
        </div>
        <div class="mt-8 flex justify-between">
          <button disabled class="px-5 py-2 text-sm text-gray-400 cursor-not-allowed">Back</button>
          <button class="px-6 py-2 bg-indigo-600 text-white rounded-xl text-sm font-medium hover:bg-indigo-700 transition">Next Step &#8594;</button>
        </div>
      </div>
    </div>

    <!-- 6. Settings Panel -->
    <div>
      <h2 class="text-lg font-bold text-gray-900 dark:text-white mb-4">Settings Panel</h2>
      <div class="max-w-lg bg-white dark:bg-gray-800 rounded-2xl p-8 border border-gray-200 dark:border-gray-700 shadow-sm space-y-6">
        <div class="flex items-center justify-between">
          <div><h3 class="text-sm font-medium text-gray-900 dark:text-white">Email Notifications</h3><p class="text-xs text-gray-400">Receive updates about your account</p></div>
          <button onclick="this.dataset.on=this.dataset.on==='true'?'false':'true';this.classList.toggle('bg-indigo-600');this.classList.toggle('bg-gray-300');this.querySelector('span').classList.toggle('translate-x-5')" data-on="true" class="w-11 h-6 bg-indigo-600 rounded-full relative transition"><span class="absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full shadow transition translate-x-5"></span></button>
        </div>
        <div class="flex items-center justify-between">
          <div><h3 class="text-sm font-medium text-gray-900 dark:text-white">Two-Factor Auth</h3><p class="text-xs text-gray-400">Add extra security to your account</p></div>
          <button onclick="this.dataset.on=this.dataset.on==='true'?'false':'true';this.classList.toggle('bg-indigo-600');this.classList.toggle('bg-gray-300');this.querySelector('span').classList.toggle('translate-x-5')" data-on="false" class="w-11 h-6 bg-gray-300 rounded-full relative transition"><span class="absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full shadow transition"></span></button>
        </div>
        <div class="flex items-center justify-between">
          <div><h3 class="text-sm font-medium text-gray-900 dark:text-white">Dark Mode</h3><p class="text-xs text-gray-400">Switch between light and dark themes</p></div>
          <button onclick="this.dataset.on=this.dataset.on==='true'?'false':'true';this.classList.toggle('bg-indigo-600');this.classList.toggle('bg-gray-300');this.querySelector('span').classList.toggle('translate-x-5');document.documentElement.classList.toggle('dark')" data-on="false" class="w-11 h-6 bg-gray-300 rounded-full relative transition"><span class="absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full shadow transition"></span></button>
        </div>
        <div class="pt-4 border-t border-gray-200 dark:border-gray-700 flex gap-3">
          <button class="px-5 py-2 bg-indigo-600 text-white rounded-xl text-sm font-medium hover:bg-indigo-700 transition">Save Changes</button>
          <button class="px-5 py-2 border border-gray-300 dark:border-gray-600 rounded-xl text-sm hover:bg-gray-50 dark:hover:bg-gray-700 transition text-gray-700 dark:text-gray-300">Cancel</button>
        </div>
      </div>
    </div>

  </div>
</body>
</html>
```

## Customization Guide
- **Form actions**: Replace `action="/api/..."` with your endpoint (Formspree, Netlify, custom)
- **Validation**: Add `pattern`, `minlength`, `maxlength` attributes for client-side validation
- **Social login**: Replace button text with SVG icons for Google, GitHub, Apple
- **Wizard steps**: Add JS to show/hide step content and update step indicator colors
- **Toggle switches**: The inline `onclick` handlers work standalone; replace with React/Vue state in frameworks
- **Accessibility**: Add `aria-label`, `aria-required`, and proper `id`/`for` pairings for screen readers

## 2026 Trend Notes
- Rounded input fields (`rounded-xl`) with subtle borders are the current standard
- Social login divider ("or continue with") is expected UX for auth forms
- Keyboard shortcut hint in search bar (`Ctrl+K`) follows the command palette pattern
- Toggle switches with inline JS provide framework-agnostic interactivity
- Multi-step wizards with numbered indicators reduce form abandonment
