Combobox
Reusable combobox component.
Usage
Components are auto-discovered. Use the component directly in any .wrn view:
<Combobox
id="combobox"
name="name"
label="Choose an option"
placeholder="Search options"
options="[]"
/>Legacy mount name: data-component="Combobox".
Props and attributes
| Prop | Type | Requirement | Default |
|---|---|---|---|
id | string | Optional | "combobox" |
name | string | Optional | "" |
label | string | Optional | "Choose an option" |
placeholder | string | Optional | "Search options" |
options | string | Optional | [] |
required | boolean | Optional | false |
disabled | boolean | Optional | false |
class | string | Optional | "" |
Slots
This component does not declare a slot.
Events
This component does not declare a custom event.
Source contract
Installed source: components/Combobox.wrn
component Combobox {
props {
id = "combobox"
name = ""
label = "Choose an option"
placeholder = "Search options"
options = []
required = false
disabled = false
class = ""
}
view {
<div class="wire-field {class}">
<label for="{id}" class="wire-label">{label}</label>
<input id="{id}" name="{name}" list="{id}-options" placeholder="{placeholder}" required="{required}" disabled="{disabled}" role="combobox" aria-autocomplete="list" class="wire-input" />
<datalist id="{id}-options">{#each options as option}<option value="{option.value}">{option.label}</option>{/each}</datalist>
</div>
}
}