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.
configpublicPartial<OverlayConfig>{}Configure the many options of the `OverlayController`OverlayMixin
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
openedpublicbooleanfalseIf you add the opened attribute a dialog will be opened on page load. The invoker can be left out in case the user does not need to be able to reopen the dialog.OverlayMixin
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
_overlayBackdropNodeprotectedOverlayMixin
_overlayContentNodeprotectedOverlayMixin
_overlayContentWrapperNodeprotectedOverlayMixin
_overlayInvokerNodeprotectedThe node that opens/closes this overlay. Resolved in a stable, declarative way (independent of the exact DOM order) by looking, in order, for: 1. a child with `[slot=“invoker”]` 2. any element in the same root that opts in via `[data-invoker]` and references this host by id (`for=“<id>”`) 3. a preceding sibling that opts in via `[data-invoker]`OverlayMixin
_overlayReferenceNodeprotectedOverlayMixin
_selectionDisplayNodeprotectedSelectionDisplay | null

Methods

NamePrivacyDescriptionParametersReturnInherited From
clearpublic
closepublicHides the overlayOverlayMixin
matchConditionpublicWhen the preconfigurable `match-mode` conditions are not sufficient, one can define a custom matching function.option: LionOption, textboxValue: string
openpublicShows the overlayOverlayMixin
parserpublicConverts viewValue to modelValuevalue: string|string[]*
repositionOverlaypublicSometimes it’s needed to recompute Popper position of an overlay, for instance when we have an opened combobox and the surrounding context changes (the space consumed by the textbox increases vertically)OverlayMixin
resetpublic
togglepublicToggles the overlayOverlayMixin
_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.
_defineOverlayprotected{ contentNode, invokerNode, referenceNode, backdropNode, contentWrapperNode }, config: DefineOverlayConfigOverlayControllerOverlayMixin
_defineOverlayConfigprotectedOverlayConfigOverlayMixin
_enhanceLightDomClassesprotected
_getInvokerNodeprotectedElement|nullOverlayMixin
_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
_isPermanentlyDisconnectedprotectedWhen we’re moving around in dom, disconnectedCallback gets called. Before we decide to teardown, let’s wait to see if we were not just moving nodes around.Promise<boolean>OverlayMixin
_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
_setOpenedWithoutPropertyEffectsprotectedWhen the opened state is changed by an Application Developer,cthe OverlayController is requested to show/hide. It might happen that this request is not honoured (intercepted in before-hide for instance), so that we need to sync the controller state to this webcomponent again, preventing eternal loops.newOpened: booleanOverlayMixin
_setTextboxValueprotectedv: string
_setupListboxNodeprotected
_setupOpenCloseListenersprotectedOverlayMixin
_setupOverlayCtrlprotectedOverlayMixin
_showOverlayConditionprotected{ lastKey }, options: { currentValue?: string, lastKey?: string }boolean
_syncToTextboxConditionprotectedmodelValue: string|string[], oldModelValue: string|string[], { phase }, config: {phase?:string}
_syncToTextboxMultipleprotectedmodelValue: string[], oldModelValue: string[]
_teardownOpenCloseListenersprotectedOverlayMixin
_teardownOverlayCtrlprotectedOverlayMixin
_textboxOnClickprotectedev: FocusEvent
_textboxOnInputprotectedev: Event
_textboxOnKeydownprotectedev: KeyboardEvent
_unhighlightMatchedOptionprotectedoption: Element

Events

NameTypeDescriptionInherited From
model-value-changedCustomEvent
opened-changedCustomEventOverlayMixin

Attributes

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

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>