Combobox

Live Demos Hub
GitHub ↗

Combobox

Interactive production-grade hypermedia component for HTMXUI.

Interactive Preview

HTML Source

<!-- 
  Component: combobox.html
  Configurable State: themeColor ('primary'|'secondary'|'destructive'), size ('sm'|'md'|'lg'), isOpen (boolean)
  Usage: Bind styles dynamically using hx-class="{ 'bg-primary': themeColor === 'primary' }" or hx-style="{ width: size === 'lg' ? '100%' : 'auto' }"
-->
<div hx-ext="reactive" hx-state="{ themeColor: \'primary\', size: \'md\', isOpen: false }"  class="relative">
  <input type="text" name="{name}" placeholder="{placeholder}" class="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring" hx-post="{search_url}" hx-trigger="keyup changed delay:300ms" hx-target="#{dropdown_id}" />
  <div id="{dropdown_id}" class="absolute z-10 w-full mt-1 bg-background border border-border rounded-md shadow-md hidden empty:hidden target:block"></div>
</div>