The Menu component displays a menu that lets the user choose a single value for a specific attribute.
The attribute passed to the attribute
prop must be present in “attributes for faceting”
on the Algolia dashboard or configured as attributesForFaceting
via a set settings call to the Algolia API.
If you are using the searchable
prop, you’ll also need to make the attribute searchable using
the dashboard or using the API.
type: string | ||
the name of the attribute in the record | ||
type: boolean | default: false | |
true if the component should display a button that will expand the number of items | ||
type: number | default: 10 | |
the minimum number of diplayed items | ||
type: number | default: 20 | |
the maximun number of displayed items. Only used when showMore is set to | ||
type: string | ||
the value of the item selected by default | ||
type: function | ||
Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return. | ||
type: boolean | default: false | |
true if the component should display an input to search for facet values. |
import React from 'react'; import { InstantSearch, Menu } from 'react-instantsearch-dom'; const App = () => ( <InstantSearch appId="latency" apiKey="6be0576ff61c053d5f9a3225e2a90f76" indexName="instant_search" > <Menu attribute="categories" /> </InstantSearch> );
the root div of the widget | ||
the search box of the widget. See the SearchBox documentation for the classnames and translation keys of the SearchBox. | ||
the list of all menu items | ||
the menu list item | ||
the selected menu list item | ||
the clickable menu element | ||
the label of each item | ||
the count of values for each item | ||
the div displayed when there are no results | ||
the button used to display more categories | ||
the disabled button used to display more categories |
The label of the show more button. Accepts one parameters, a boolean that is true if the values are expanded | ||
The label of the no results text when no search for facet values results are found. |