Widget API Pattern
Every widget is a function that accepts an options object:search.start():
Search Widgets
searchBox
A search input with submit and reset buttons:searchAsYouType(default:true) - Search as user types vs. on submit onlyqueryHook- Transform query before search (useful for debouncing)autofocus- Focus input on page load
hits
Display search results:html- Tagged template function for renderingcomponents- Highlight, Snippet, and other helper componentssendEvent- Function to track insights events
infiniteHits
Load more results with infinite scrolling:configure
Set search parameters without UI:Filtering Widgets
refinementList
Faceted search filters with checkboxes:attribute- Index attribute to filter onoperator-"or"(default) or"and"for combining valuessearchable- Add search within facetsshowMore- Enable “Show more” button
hierarchicalMenu
Multi-level categorization:menu
Single-select filter:rangeInput
Numeric range filter with min/max inputs:rangeSlider
Numeric range filter with slider:The
rangeSlider widget requires the nouislider library:toggleRefinement
Boolean on/off filter:ratingMenu
Star rating filter:numericMenu
Predefined numeric ranges:Refinement Management
currentRefinements
Display active filters:clearRefinements
Clear all or specific filters:Navigation Widgets
pagination
Navigate between result pages:breadcrumb
Show hierarchical navigation path:Utility Widgets
stats
Display search statistics:sortBy
Switch between index replicas:hitsPerPage
Select results per page:poweredBy
Show “Search by Algolia” logo:Advanced Widgets
panel
Wrap any widget with a header/footer:index
Query multiple indices:dynamicWidgets
Automatically render facets based on search results:AI-Powered Widgets
chat
Conversational search interface:filterSuggestions
AI-powered filter recommendations:Recommendation Widgets
trendingItems
Show trending products:relatedProducts
Show related products based on objectID:frequentlyBoughtTogether
Show products frequently bought together:Next Steps
Customization
Customize templates and create custom widgets
Styling
Style your search interface with CSS
Routing
Synchronize search state with URLs
Custom Widgets
Build your own widgets with connectors