atomic-search-box

This is for:

Developer

The atomic-search-box component creates a search box with built-in support for suggestions.

Introduction

The Search Box component is the core of a search page, allowing the user to type and submit a query. There is built-in support for query suggestions in the Search Box component.

User Experience and Best Practices

Guidelines

It’s important to have it visible and clear to the user, best practices suggest that it should be in the top-center or upper-right section.

Properties

Property Attribute Description Type Default

clearFilters

clear-filters

Whether to clear all active query filters when the end user submits a new query from the search box. Setting this option to "false" is not recommended & can lead to an increasing number of queries returning no results.

boolean

true

disableSearch

disable-search

Whether to prevent the user from triggering a search from the component. Perfect for use cases where you need to disable the search conditionally, like when the input is empty.

boolean

false

enableQuerySyntax

enable-query-syntax

Whether to interpret advanced Coveo Cloud query syntax in the query. You should only enable query syntax in the search box if you have good reasons to do so, as it requires end users to be familiar with Coveo Cloud query syntax, otherwise they will likely be surprised by the search box behaviour.

When the redirection-url property is set and redirects to a page with more atomic-search-box components, all atomic-search-box components need to have the same enable-query-syntax value.

boolean

false

numberOfQueries

number-of-queries

The amount of queries displayed when the user interacts with the search box. By default, a mix of query suggestions and recent queries will be shown. You can configure those settings using the following components as children: - atomic-search-box-query-suggestions - atomic-search-box-recent-queries

number

8

redirectionUrl

redirection-url

Defining this option makes the search box standalone (see Use a standalone search box(https://docs.coveo.com/en/atomic/latest/usage/ssb/).

This option defines the default URL the user should be redirected to, when a query is submitted. If a query pipeline redirect is triggered, it will redirect to that URL instead (see query pipeline triggers).

string | undefined

suggestionTimeout

suggestion-timeout

The timeout for suggestion queries, in milliseconds. If a suggestion query times out, the suggestions from that particular query won’t be shown.

number

400

Shadow Parts

Part Description

active-suggestion

The currently active suggestion.

clear-button

The button to clear the search box of input.

clear-icon

The clear button’s icon.

input

The search box input.

instant-results-item

An instant result rendered by an atomic-search-box-instant-results component.

instant-results-show-all

The clickable suggestion to show all items for the current instant results search rendered by an atomic-search-box-instant-results component.

instant-results-show-all-button

The button inside the clickable suggestion from the atomic-search-box-instant-results component.

loading

The search box loading animation.

query-suggestion-content

The contents of a suggestion from the atomic-search-box-query-suggestions component.

query-suggestion-icon

The icon of a suggestion from the atomic-search-box-query-suggestions component.

query-suggestion-item

A suggestion from the atomic-search-box-query-suggestions component.

query-suggestion-text

The text of a suggestion from the atomic-search-box-query-suggestions component.

recent-query-clear

The "clear" text of the clear button above suggestions from the atomic-search-box-recent-queries component.

recent-query-content

The contents of a suggestion from the atomic-search-box-recent-queries component.

recent-query-icon

The icon of a suggestion from the atomic-search-box-recent-queries component.

recent-query-item

A suggestion from the atomic-search-box-recent-queries component.

recent-query-text

The text of a suggestion from the atomic-search-box-recent-queries component.

recent-query-text-highlight

The highlighted portion of the text of a suggestion from the atomic-search-box-recent-queries component.

recent-query-title

The "recent searches" text of the clear button above suggestions from the atomic-search-box-recent-queries component.

recent-query-title-content

The contents of the clear button above suggestions from the atomic-search-box-recent-queries component.

recent-query-title-item

The clear button above suggestions from the atomic-search-box-recent-queries component.

submit-button

The search box submit button.

submit-icon

The search box submit button’s icon.

suggestion

A suggested query correction.

suggestion-divider

An item in the list that separates groups of suggestions.

suggestion-with-query

An item in the list that will update the search box query.

suggestions

A list of suggested query corrections on each panel.

suggestions-double-list

The wrapper that contains 2 suggestion lists.

suggestions-left

A list of suggested query corrections on the left panel.

suggestions-right

A list of suggested query corrections on the right panel.

suggestions-single-list

The wrapper that contains 1 suggestion list.

suggestions-wrapper

The wrapper that contains suggestion panels.

wrapper

The search box wrapper.