Overview
TheNextQueries component renders a list of suggested follow-up search queries based on common search patterns. If users typically search for “shirts” and then “trousers”, for example, “trousers” would be suggested as a next query after “shirts”. This helps users refine and continue their search journey.
When to Use
Use the NextQueries component to:- Guide users to related searches after they perform a query
- Improve search flow by suggesting logical next steps
- Help users discover related products or categories
- Reduce search friction by anticipating user needs
Installation
Import the component from the next-queries module:Basic Usage
The component automatically displays next queries after a search is performed:Props
This component inherits all props from Base Components and adds additional functionality:Animation component that will be used to animate the suggestions.
Number of next queries to be rendered. By default, it limits to 5 suggestions.
Flag to indicate if curated next queries should be displayed differently from algorithmic ones. When true, curated queries can have distinct styling.
Optional array of next queries to use instead of the state’s next queries. Useful for providing custom suggestions.
Slots
suggestion Slot
Customize the entire next query item including the wrapper. Slot Props:suggestion(Suggestion) - The next query suggestion dataindex(number) - The index of the suggestion in the listhighlightCurated(boolean) - Whether curated queries should be highlighted
suggestion-content Slot
Customize only the content of each next query. Slot Props:suggestion(Suggestion) - The next query suggestion dataindex(number) - The index of the suggestion in the listshouldHighlightCurated(boolean) - Whether this specific query should be highlighted
Events
The component emits events through the event bus:- UserSelectedANextQuery: Emitted when a user clicks on a next query suggestion
Examples
Basic Example
Display next queries after a search with default styling:With Animation and Curated Highlighting
Add animations and highlight curated suggestions:Custom Content with Icons
Add icons and custom styling to next query items:Custom Next Query Component
Create a fully custom next query implementation:Integration Tips
Next queries are generated from user behavior patterns in your search service. Make sure your API is configured to return next query suggestions based on search analytics.
Curated vs Algorithmic
Next queries can be either:- Algorithmic: Generated automatically from user search patterns
- Curated: Manually configured by merchandisers for specific queries
highlightCurated prop to visually distinguish curated suggestions, helping users identify editorially selected recommendations.
Styling
The component uses these CSS classes:.x-next-queries- Main container.x-next-queries__suggestion- Individual suggestion wrapper.x-next-query__query- Query text
Related Components
- Popular Searches - Display trending searches
- Related Tags - Show tag-based refinements
- Query Suggestions - Autocomplete suggestions
