AutoCompleteOptionRow
AutoCompleteOptionRowSuggestion presentation Give one suggestion a clear label and an optional selected indicator. The owning input manages interaction.
Forms & inputDefault row states
These previews isolate the row presentation. AutoCompleteInput supplies its option wrapper and keyboard interaction.
These isolated rows show presentation. Use the live picker below for keyboard and selection behavior.
<Panel bodyClass="p-3">
<AutoCompleteOptionRow
:option="{label:'Europe Central',value:'eu-central',keywords:[]}"
:selected="true"
/>
<AutoCompleteOptionRow
:option="{label:'US East',value:'us-east',keywords:[]}"
:selected="false"
/>
</Panel> Inside its owning control
The default row is already registered by the input family.
<RegorApp id="auto-complete-option-row-states-demo" src="./states.ts"/> import {
defineAutoCompleteInputComponents,
defineFormInputField,
defineIconComponents,
} from '@purestack/ts-components'
import { lucide_check, lucide_chevron_down } from '@purestack/ts-svg-icons'
import { createApp, defineComponent, html } from 'regor'
export interface AutoCompleteOptionRowStates {}
const autoCompleteOptionRowStatesTemplate = html`<AutoCompleteInput
id="default-option-owner"
label="Region"
:options="[{label:'Europe Central',value:'eu'},{label:'US East',value:'us'}]"
rowComponent="AutoCompleteOptionRow"/>`
function createAutoCompleteOptionRowStates(): AutoCompleteOptionRowStates {
return {}
}
const component = defineComponent<AutoCompleteOptionRowStates>(
autoCompleteOptionRowStatesTemplate,
{
context: createAutoCompleteOptionRowStates,
},
)
const icons: Record<string, string> = {
'lucide:check': lucide_check,
'lucide:chevron-down': lucide_chevron_down,
}
createApp(
{
components: {
AutoCompleteOptionRowStates: component,
...defineAutoCompleteInputComponents(),
...defineFormInputField(),
...defineIconComponents((name) => icons[name] ?? ''),
},
},
{
selector: 'app#auto-complete-option-row-states-demo',
template: html`<AutoCompleteOptionRowStates/>`,
},
) The row contract
option supplies the resolved label and value. active and query are available to custom rows; the default row does not highlight matches or supply selection behavior.
Default label Active query Missing option No label below because option is null.
Compare all values together. Use the live examples for application state and event handling.
Behavior and accessibility
The row is presentation only. It does not add role option, selection handlers or focus management; the owning input supplies those. selected shows a check icon. active and query are passed through for alternate renderers but are not used by this default template.
API reference
AutoCompleteOptionRow contract
Props below are the public template API. RefOrValue accepts a literal or a reactive ref; bind refs with a colon-prefixed attribute. Native attributes and events can be passed through the component root.
option
RefOrValue<ResolvedAutoCompleteOption | null> - Default
required
Resolved option object with label, value, keywords and optional disabled state. Null renders an empty label.
active
RefOrValue<boolean> - Default
false
Accepted row state; the default row does not use it.
selected
RefOrValue<boolean> - Default
false
Shows the selected check icon.
query
RefOrValue<string> - Default
not set
Accepted search query; the default row does not highlight or transform it.
Composition
No slots. Registered by defineAutoCompleteInputComponents. Include lucide:check in the icon resolver when rendering selected rows in a browser app.