What are connectors?
Connectors are the core building blocks of InstantSearch.js widgets. They provide the logic for search widgets without the rendering, allowing you to build custom UI components while leveraging InstantSearch’s powerful search functionality. Each connector:- Manages search state and parameters
- Handles search results processing
- Provides render and refine functions
- Works with any UI library or framework
How connectors work
Connectors follow a simple pattern:renderOptions: The current state and available actionsisFirstRender: Boolean indicating if this is the initial render
Available connectors
Search
Search Box
Input widget for the main search query
Results
Hits
Display search results
Infinite Hits
Display search results with infinite scrolling
Filtering
Refinement List
Multi-select faceted filtering
Hierarchical Menu
Multi-level hierarchical faceted filtering
Menu
Single-select faceted filtering
Range
Filter by numeric range
Rating Menu
Filter by rating values
Numeric Menu
Filter by numeric ranges with predefined options
Toggle Refinement
On/off filtering based on attribute value
Current Filters
Current Refinements
Display and remove active filters
Clear Refinements
Button to clear all active filters
Navigation
Pagination
Navigate between result pages
Breadcrumb
Display hierarchical navigation path
UI Controls
Hits Per Page
Select number of results per page
Sort By
Switch between indices or sorting strategies
Stats
Display search statistics
Other
Configure
Set search parameters programmatically
Powered By
Display Algolia logo
Geo Search
Search and filter by geographic location
Creating custom widgets
To create a custom widget with a connector:- Import the connector
- Define your rendering function
- Call the connector with your rendering function
- Add the widget to your InstantSearch instance