Searchable Selector
A searchable dropdown selector with circle avatar, name, and double arrow trigger. Filters items by label or value and shows avatar initials or image.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | required | The unique identifier for the selector wrapper. |
items | Array<{ value: string; label: string; avatarText?: string; avatarImage?: string }> | required | Array of selectable items with value, label, and optional avatarText or avatarImage. |
selectedValue | string | undefined | undefined | The selected item value. Supports $bindable. |
placeholder | string | 'Select an option' | Placeholder when no item is selected. |
searchPlaceholder | string | 'Search...' | Placeholder for the search input. |
disabled | boolean | false | Whether the selector is disabled. |
variant | string | '' | User-defined variant name, added to the root element. Style it with a CSS rule that starts from the root. |
Samples
1. Basic Searchable Selector
Dropdown with search, circle avatar (initials), name, and double arrow on trigger. Filters by label and value.
Selected: emre
<script> import { SearchableSelector } from 'fluid-ui-svelte/prebuilt'; const items = [ { value: "emre", label: "Emre Ayaz", avatarText: "EA" }, { value: "alice", label: "Alice Johnson", avatarText: "AJ" }, { value: "bob", label: "Bob Smith", avatarText: "BS" } ]; let selectedValue = $state("emre");</script> <SearchableSelector id="user-selector" {items} bind:selectedValue placeholder="Select a user" searchPlaceholder="Search users..."/>2. With Avatar Images
Uses avatarImage URL for circle avatar instead of initials. Falls back to initials if no image.
Selected: none
<script> import { SearchableSelector } from 'fluid-ui-svelte/prebuilt'; const items = [ { value: "emre", label: "Emre Ayaz", avatarImage: "https://picsum.photos/id/1011/100/100" }, { value: "sarah", label: "Sarah Connor", avatarImage: "https://picsum.photos/id/1027/100/100" } ]; let selectedValue = $state();</script> <SearchableSelector id="user-selector-images" {items} bind:selectedValue placeholder="Choose a person" searchPlaceholder="Search people..."/>