Explore related content in the Algolia Academy
InstantSearch
- Start with a predefined widget that you can configure and style with CSS.
- To change its render output (DOM or Native), customize a predefined widget to render what you want.
- To implement something that doesn’t exist, create a custom widget.
Predefined widgets
The recommended way to use InstantSearch is with its predefined widgets such assearchBox
.
InstantSearch includes a set of widgets that are most often used in search experiences.
Widgets provide features and a rendered output.
You can place them anywhere on your UI, configure them, and style them with CSS.
For example, add the refinementList
` widget and ask it to show a list of brands,
so your users can refine their search using those brands.
JavaScript
The InstantSearch wrapper
Theinstantsearch
wrapper communicates between your app and Algolia.
This is where you add all the widgets.
It accepts a search client and an index name.
JavaScript
start
method to begin searching:
JavaScript
CSS theme
The predefined widgets in InstantSearch.js are compatible with the default CSS theme:
Customize widgets
Algolia’s predefined widgets, with their fixed behavior and output, may not fully meet your requirements. For example, you might want to customize the rendering of themenu
widget to display as a select
element instead of a list of links. You may also want to render it as a keyboard-controlled slideshow of images.
To address these limitations, InstantSearch.js uses connectors to redefine widget behavior and DOM output.
For more information, see Customize an InstantSearch.js widget.