Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Search Bar

The lens-searchbar component offers an interface for exploring of all single-select items. It serves as the primary interface for users to search, apply, and adjust query criteria. Selected items appear as interactive chips within the component, giving users a clear visual of their active filters. Users can easily refine their search by removing individual values or entire criteria directly from the chip display.


Behavior & Functionality

  • Search Input with Autocomplete:

    • Opens dropdown after 3+ characters.
    • Filters and displays grouped suggestions with optional counts and descriptions.
    • Keyboard navigation support (focusedItemIndex).
  • Search Chips:

    • Displays selected criteria as removable chips.
    • Nested value-level and item-level delete buttons.
    • Each chip displays:
      • Criterion name
      • Values
      • Optional explain button via QueryExplainButtonComponent
  • Autocomplete Items:

    • Rendered with bold-highlighted matches.
    • Supports facet counts from $facetCounts.
    • Fully keyboard- and mouse-navigable.
  • Clear Group Button:

    • Clears the entire group when clicked.
    • Emits a clear-search event.

Props

PropTypeDefaultDescription
noMatchesFoundMessagestring"No matches found"Message shown when no autocomplete options are found.
typeMoreMessagestring"Search will start with 3 inserted letters"Message shown when input is too short for autocomplete.
placeholderTextstring"Type to filter conditions"Placeholder in the search input field.
indexnumber0Used to manage multiple search bars (e.g., in groups or filters).

Events

Triggered when the group clear button is clicked.

<lens-search-bar on:clear-search={handleClear} />

Example

<lens-search-bar
    placeholderText="Search filters..."
    noMatchesFoundMessage="No criteria match"
    typeMoreMessage="Type at least 3 characters to search"
    index="{1}"
/>

Styling

PartPurpose
lens-searchbarWrapper for the entire component
lens-searchbar-inputMain input element
lens-searchbar-chip, chip-name, chip-itemVisual query chips
lens-searchbar-autocomplete-optionsAutocomplete container
lens-searchbar-autocomplete-options-itemIndividual result
lens-searchbar-autocomplete-options-item-focusedHighlighted result
lens-searchbar-autocomplete-options-item-descriptionOptional description
lens-searchbar-autocomplete-options-item-facet-countFacet count badge