Component

Search with Autocomplete

Search input components with autocomplete dropdown suggestions

  • Component
  • Tailwind
  • MIT

Preview

Live component

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

Install

Add to your project

terminal
npx devsnips add Tailwind/Components/Input/search-with-autocomplete
registry path: Tailwind/Components/Input/search-with-autocomplete

Source

Implementation

code.html
<!-- Search with Autocomplete - Dropdown -->
<div class="relative max-w-md">
  <label class="block text-sm font-medium text-gray-700 mb-1">Search Country</label>
  <div class="relative">
    <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
      <svg class="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>
    </div>
    <input type="text" placeholder="Type to search..." class="w-full pl-10 pr-4 py-3 bg-white border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" />
  </div>
  <div class="absolute z-10 w-full mt-1 bg-white border border-gray-200 rounded-lg shadow-lg">
    <div class="p-2 hover:bg-gray-50 cursor-pointer flex items-center gap-3">
      <span class="text-xl">🇺🇸</span>
      <div><p class="text-sm font-medium text-gray-900">United States</p><p class="text-xs text-gray-500">North America</p></div>
    </div>
    <div class="p-2 hover:bg-blue-50 cursor-pointer flex items-center gap-3 bg-blue-50">
      <span class="text-xl">🇬🇧</span>
      <div><p class="text-sm font-medium text-gray-900">United Kingdom</p><p class="text-xs text-gray-500">Europe</p></div>
    </div>
    <div class="p-2 hover:bg-gray-50 cursor-pointer flex items-center gap-3">
      <span class="text-xl">🇩🇪</span>
      <div><p class="text-sm font-medium text-gray-900">Germany</p><p class="text-xs text-gray-500">Europe</p></div>
    </div>
  </div>
</div>

<!-- Search with Autocomplete - Command Palette -->
<div class="mt-6 p-6 bg-slate-900 rounded-2xl max-w-md">
  <label class="block text-sm font-medium text-gray-300 mb-2">Quick Actions</label>
  <div class="relative">
    <div class="absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none">
      <svg class="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>
    </div>
    <input type="text" placeholder="Type a command..." class="w-full pl-10 pr-4 py-3 bg-slate-800 border border-slate-600 rounded-xl text-white placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-400" />
  </div>
  <div class="mt-3 space-y-1">
    <div class="p-3 hover:bg-slate-800 cursor-pointer rounded-lg flex items-center gap-3">
      <span class="text-gray-400">⌘</span>
      <div class="flex-1"><p class="text-sm text-white">Go to Dashboard</p><p class="text-xs text-gray-500">Navigate to dashboard</p></div>
    </div>
    <div class="p-3 hover:bg-slate-800 cursor-pointer rounded-lg flex items-center gap-3 bg-slate-800">
      <span class="text-gray-400">⌘</span>
      <div class="flex-1"><p class="text-sm text-white">Create New Project</p><p class="text-xs text-gray-500">Start a new project</p></div>
    </div>
  </div>
</div>
45 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/search-with-autocomplete
Prompt instruction
I want to use this DevSnips resource in production:

Page:
https://devsnips.site/library/tailwind/components/input/search-with-autocomplete/

Install: npx devsnips add
Tailwind/Components/Input/search-with-autocomplete

This is the Search with Autocomplete — Search input components with autocomplete dropdown suggestions

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/search-with-autocomplete