Search

Find components, guides, and documentation

Combobox: API Table

class: LionCombobox, lion-combobox

Fields

NamePrivacyTypeDefaultDescriptionInherited From
allowCustomChoicepublicboolean
autocompletepublic'none'|'list'|'inline'|'both''both'When “list”, will filter listbox suggestions based on textbox value. When “both”, an inline completion string will be added to the textbox as well.
matchModepublic'begin'|'all''all'When typing in the textbox, will by default be set on ‘begin’, only matching the beginning part in suggestion list. => ‘a’ will match ‘apple’ from [‘apple’, ‘pear’, ‘citrus’]. When set to ‘all’, will match middle of the word as well => ‘a’ will match ‘apple’ and ‘pear’
modelValuepublic
requireOptionMatchpublicbooleantrueIf set to false, the value is allowed to not match any of the options. We set the default to true for backwards compatibility
rotateKeyboardNavigationpublicbooleantrue
selectionFollowsFocuspublicbooleantrue
showAllOnEmptypublicbooleanfalseWhen true, the listbox is open and textbox goes from a value to empty, all options are shown. By default, the listbox closes on empty, similar to wai-aria example and <datalist>
slotspublicSlotsMap
valuepublicWe define the value getter/setter below as also defined in LionField (via FormatMixin). Since FormatMixin is meant for Formgroups/ChoiceGroup it’s not applied on Combobox; Combobox is somewhat of a hybrid between a ChoiceGroup and LionField, therefore we copy over some of the LionField members to align with its interface. The view value. Will be delegated to `._inputNode.value`
_activeDescendantOwnerNodeprotected
_ariaVersionprotected'1.1'|'1.0'For optimal support, we allow aria v1.1 on newer browsers
_comboboxNodeprotectedHTMLElementWrapper with combobox role for the text input that the end user controls the listbox with.
_feedbackConditionMetaprotectedLionListbox
_focusableNodeprotectedLionListbox
_inputNodeprotected
_listboxNodeprotected
_listboxReceivesNoFocusprotectedbooleantrue
_noTypeAheadprotectedbooleantrue
_overlayContentNodeprotected
_overlayInvokerNodeprotected
_overlayReferenceNodeprotected
_selectionDisplayNodeprotectedSelectionDisplay | null

Methods

NamePrivacyDescriptionParametersReturnInherited From
clearpublic
matchConditionpublicWhen the preconfigurable `match-mode` conditions are not sufficient, one can define a custom matching function.option: LionOption, textboxValue: string
parserpublicConverts viewValue to modelValuevalue: string|string[]*
resetpublic
_autoSelectConditionprotectedWhen this condition is false, an end user will have to manually select a suggested option from the list (by default when autocomplete is ‘none’ or ‘list’). For autocomplete ‘both’ or ‘inline’, it will automatically select on a match.
_defineOverlayConfigprotected
_enhanceLightDomClassesprotected
_getTextboxValueFromOptionprotectedReturn the value to be used for the input valueoption: LionOptionstring
_groupTwoTemplateprotected
_handleAutocompletionprotectedHandles autocompletion. This entails: - list: shows a list on keydown character press - filter: filters list of potential matches according to matchmode or provided matchCondition - focus: automatically focuses closest match (makes it the activedescendant) - check: automatically checks/selects closest match when selection-follows-focus is enabled (this is the default configuration) - complete: completes the textbox value inline (the ‘missing characters’ will be added as selected text)
_highlightMatchedOptionprotectedoption: Element, matchingString: string
_inputGroupInputTemplateprotected
_listboxOnClickprotectedev: MouseEvent
_listboxOnKeyDownprotectedev: KeyboardEvent
_onFilterMatchprotectedoption: LionOption & {__originalInnerHTML?:string}, matchingString: string
_onFilterUnmatchprotectedoption: LionOption & {__originalInnerHTML?:string}, curValue: string, prevValue: string
_onKeyUpprotectedev: KeyboardEvent
_onListboxContentChangedprotected
_overlayListboxTemplateprotected
_repropagationConditionprotectedtarget: FormControlHost
_resetListboxOptionsprotected
_setTextboxValueprotectedv: string
_setupListboxNodeprotected
_setupOpenCloseListenersprotected
_setupOverlayCtrlprotected
_showOverlayConditionprotected{ lastKey }, options: { currentValue?: string, lastKey?: string }boolean
_syncToTextboxConditionprotectedmodelValue: string|string[], oldModelValue: string|string[], { phase }, config: {phase?:string}
_syncToTextboxMultipleprotectedmodelValue: string[], oldModelValue: string[]
_teardownOpenCloseListenersprotected
_teardownOverlayCtrlprotected
_textboxOnClickprotectedev: FocusEvent
_textboxOnInputprotectedev: Event
_textboxOnKeydownprotectedev: KeyboardEvent
_unhighlightMatchedOptionprotectedoption: Element

Events

NameTypeDescriptionInherited From
model-value-changedCustomEvent

Attributes

NameFieldInherited From
autocompleteautocomplete
match-modematchMode
show-all-on-emptyshowAllOnEmpty
requireOptionMatchrequireOptionMatch
allow-custom-choiceallowCustomChoice
__shouldAutocompleteNextUpdate__shouldAutocompleteNextUpdate

Slots

NameDescription
listboxThe listbox element for the combobox, e.g. <lion-options>
selection-displayThe selection display element for the combobox, e.g. <lion-selection-display>