Widgets > InstantSearch

Description

<InstantSearch> is the root component of all React InstantSearch implementations. It provides all the connected components (aka widgets) a means to interact with the searchState.

Props

appId*
type: string 

Your Algolia application id.

apiKey*
type: string 

Your Algolia search-only API key.

indexName*
type: string 

Main index in which to search.

algoliaClient
type: object 

Provide a custom Algolia client instead of the internal one.

onSearchStateChange
type: func 

Function to be called everytime a new search is done. Useful for URL Routing.

searchState
type: object 

Object to inject some search state. Switches the InstantSearch component in controlled mode. Useful for URL Routing.

createURL
type: func 

Function to call when creating links, useful for URL Routing.

resultsState
type: SearchResults|SearchResults[] 

Use this to inject the results that will be used at first rendering. Those results are found by using the findResultsState function. Useful for Server Side Rendering.

Requirements

You will need to have an Algolia account to be able to use this widget. Create one now.

Example usage

  
Code
import {InstantSearch, SearchBox, Hits} from 'react-instantsearch/dom'; export default function Search() { return ( <InstantSearch appId="appId" apiKey="apiKey" indexName="indexName" > <SearchBox /> <Hits /> </InstantSearch> ); }

CSS classes

This widget has no theming options.

Translation keys

This widget has no translations.