Signature
Import
- Component
- Plugin
To ensure optimal bundle sizes,
see Optimize build size.
Vue
About this widget
Theais-rating-menu
lets users refine search results by clicking on stars.
The stars are based on the selected attribute.
Requirements
Theattribute
provided to the widget must be in attributes for faceting,
either on the dashboard
or using the attributesForFaceting
parameter with the API.
Examples
Vue
Props
The name of the attribute in the record.
Vue
The maximum value for the rating.
This value is exclusive,
which means the number of stars will be the provided value, minus one.
Vue
The CSS classes you can override:
ais-RatingMenu
. The root element of the widget.ais-RatingMenu-starSymbol
. The SVG symbol for a filled star.ais-RatingMenu-starEmptySymbol
. The SVG symbol for an empty star.ais-RatingMenu-list
. The list of ratings.ais-RatingMenu-item
. The item of the ratings list.ais-RatingMenu-link
. The link of each rating 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 ”& Up” label.ais-RatingMenu-count
. The number of results for the rating.
Vue
Customize the UI
default
The slot to override the complete DOM output of the widget.When you implement this slot,
none of the other slots will change the output,
as the default slot surrounds them.Scope
items: object[]
. The list of available refinements.canRefine: boolean
. Whether a refinement can be applied.refine: (value: string) => void
. A function to select the next refinement.createURL: (item: string) => string
. A function to generate a link from the refinement.sendEvent: (eventType: 'click', facetValue: string) => void
. The function to sendclick
events.- The
view
event is automatically sent when the facets are rendered. - The
click
event is automatically sent whenrefine
is called. - You can learn more about the middleware.
- The
object
containing:count: number
. The number of results that match this refinement.isRefined: boolean
. Whether the refinement is selected.name: string
. The name corresponding to the number of stars.value: string
. The number of stars with a string form.stars: boolean[]
. The list of stars to generate with:true
. Represents a filled starfalse
. Represents an empty star
Vue
HTML output
HTML