Searchable Select

Searchable Select

Forms
Selection

Dropdown with live search filtering and visual selection state for quick access to large lists. Perfect for framework selection, user pickers, and filtered dropdowns.

Preview

A Select-style trigger that opens the searchable list. Type to filter.

Panel and states

The list can also render inline. Shown with a selection, and with a search that finds nothing.

With selection

No results

No results found

Try a different search term

Props

SearchableSelect component API reference

PropTypeDefaultDescription
itemsSelectItem[]—Available items to select from
defaultValuestring—Default selected item ID
valuestring—Controlled selected value
onValueChange(id: string) => void—Called when selection changes
placeholderstring'Search...'Placeholder text for search input
emptyMessagestring'No results found'Empty state message
mode'panel' | 'field''panel'Inline panel, or a Select-style trigger that opens it in a popover
triggerPlaceholderstring—Trigger text when nothing is selected (field mode)
defaultSearchstring—Initial search text
classNamestring—Additional CSS classes

SelectItem Type

interface SelectItem {
id: string
label: string
icon?: LucideIcon
}

Usage

Import and implementation example

import { SearchableSelect } from '@/components/ui/searchable-select'
import { Code, Globe, Zap } from 'lucide-react'
const frameworks = [
{ id: 'react', label: 'React', icon: Code },
{ id: 'vue', label: 'Vue.js', icon: Code },
{ id: 'nextjs', label: 'Next.js', icon: Globe },
{ id: 'astro', label: 'Astro', icon: Zap },
]
export default function Example() {
const [value, setValue] = useState('react')
return (
<>
{/* Basic searchable select */}
<SearchableSelect
items={frameworks}
defaultValue="react"
placeholder="Search framework..."
emptyMessage="No frameworks found"
onValueChange={(id) => console.log('Selected:', id)}
/>
{/* Controlled mode */}
<SearchableSelect
items={frameworks}
value={value}
onValueChange={setValue}
placeholder="Choose a framework..."
/>
</>
)
}

Features

Built-in functionality

  • Live search filter: Real-time filtering as you type
  • Icon support: Optional icons for each option
  • Visual selection state: Clear highlighting for selected items
  • Check marks: Visual confirmation of selection
  • Empty state: Friendly message when no results found
  • Keyboard navigation: Full keyboard support
  • Controlled mode: Support for controlled and uncontrolled usage

Accessibility

Accessibility considerations

ARIA Attributes

Uses Popover with proper ARIA attributesSearch input is properly labeledOptions have role="option"Selected state uses aria-selected

Keyboard Navigation

KeyAction
TabFocus the trigger button
Enter/SpaceOpen dropdown
Arrow Up/DownNavigate options
EnterSelect highlighted option
EscapeClose dropdown

Notes

  • Search input auto-focuses on open
  • Check icon indicates selected item
  • Empty state is announced to screen readers
  • Dropdown closes on selection