Overview
ThePopularSearches component renders a list of trending search queries that have been frequently searched by users. These queries may optionally include associated filters to refine the search. It’s an effective way to guide users toward popular content and improve search discovery.
When to Use
Use the PopularSearches component to:- Display trending searches on empty search states or landing pages
- Guide users toward popular queries
- Fill the search experience with relevant suggestions
- Showcase seasonal or trending search topics
Installation
Import the component from the popular-searches module:Basic Usage
The simplest implementation displays popular searches with default styling:Props
This component inherits all props from Base Components:Animation component that will be used to animate the suggestions. Pass a Vue animation component to add entrance effects.
Number of popular searches to be rendered. By default, it limits to 5 suggestions.
Slots
suggestion Slot
Customize the entire popular search item including the wrapper. Slot Props:suggestion(Suggestion) - The popular search suggestion dataindex(number) - The index of the suggestion in the list
suggestion-content Slot
Customize only the content of each popular search, keeping the default wrapper. Slot Props:suggestion(Suggestion) - The popular search suggestion dataindex(number) - The index of the suggestion in the list
Events
The component emits events through the event bus when users interact with suggestions:- UserSelectedAPopularSearch: Emitted when a user clicks on a popular search suggestion
Examples
With Animation and Limit
Add animations and control the number of displayed items:Custom Content with Icons
Add icons and custom styling to popular search items:Fully Custom Item
Create a completely custom popular search item with additional actions:Integration Tips
The popular searches data comes from your search service’s analytics. Ensure your API is configured to return trending queries for this component to work.
Styling
The component uses these CSS classes for styling:.x-popular-searches- Main container.x-popular-searches__suggestion- Individual suggestion wrapper.x-popular-search__query- Query text
Related Components
- Recommendations - Display recommended products
- Next Queries - Show related query suggestions
- Query Suggestions - Autocomplete suggestions
