Widgets RatingMenu

Description

RatingMenu lets the user refine search results by clicking on stars.

The stars are based on the selected attribute.

Requirements

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. The values inside the attribute must be JavaScript numbers (not strings).

Props

attribute*
type: string 

the name of the attribute in the record

min
type: number 

Minimum value for the rating. When this isn’t set, the minimum value will be automatically computed by Algolia using the data in the index.

max
type: number 

Maximum value for the rating. When this isn’t set, the maximum value will be automatically computed by Algolia using the data in the index.

defaultRefinement
type: {min: number, max: number} 

Default state of the widget containing the lower bound (end) and the max for the rating.

Example usage

import React from 'react'; import { InstantSearch, RatingMenu } from 'react-instantsearch-dom'; const App = () => ( <InstantSearch appId="latency" apiKey="6be0576ff61c053d5f9a3225e2a90f76" indexName="instant_search" > <RatingMenu attribute="rating" /> </InstantSearch> );

CSS classes

.ais-RatingMenu {}

the root div of the widget

.ais-RatingMenu--noRefinement {}

the root div of the widget when there is no refinement

.ais-RatingMenu-list {}

the list of ratings

.ais-RatingMenu-list--noRefinement {}

the list of ratings when there is no refinement

.ais-RatingMenu-item {}

the rating list item

.ais-RatingMenu-item--selected {}

the selected rating list item

.ais-RatingMenu-item--disabled {}

the disabled rating list item

.ais-RatingMenu-link {}

the rating clickable item

.ais-RatingMenu-starIcon {}

the star icon

.ais-RatingMenu-starIcon--full {}

the filled star icon

.ais-RatingMenu-starIcon--empty {}

the empty star icon

.ais-RatingMenu-label {}

the label used after the stars

.ais-RatingMenu-count {}

the count of ratings for a specific item

Translation keys

ratingLabel

Label value for the rating link