ais-menu-select
<ais-menu-select attribute="string" // Optional parameters :limit="number" :sort-by="string[]|function" :transform-items="function" :class-names="object" />
About this widget
The ais-menu-select
widget allows a user to select a single value to refine inside a select
element.
Requirements
The attribute passed to the attribute
prop must be added in attributes for faceting, either on the dashboard or using attributesForFaceting with the API.
Examples
1
<ais-menu-select attribute="categories" />
Props
attribute
|
type: string
Required
The name of the attribute in the record. |
||
Copy
|
|||
limit
|
type: number
default: 10
Optional
The maximum amount of values to display. |
||
Copy
|
|||
sort-by
|
type: string[]|function
default: ["name:asc", "count:desc"]
How to sort refinements. Must be one or more of the following strings:
It’s also possible to give a function, which receives items two by two, like JavaScript’s |
||
Copy
|
|||
transform-items
|
type: function
default: x => x
Optional
Receives the items, and is called before displaying them. Should return a new array with the same shape as the original array. Useful for mapping over the items to transform, and remove or reorder them. |
||
Copy
|
|||
class-names
|
type: object
default: {}
Optional
The CSS classes to override.
|
||
Copy
|
Customize the UI
default
|
The slot to override the complete DOM output of the widget. Scope
Where each item is an
|
||
Copy
|
|||
item
|
The slot to override the content of an Scope
Where item is an
|
||
Copy
|
|||
defaultOption
|
The slot to override the content of the ScopeNo scope is provided to this slot. |
||
Copy
|
If SEO is critical to your search page, your custom HTML markup needs to be parsable:
- use plain
<a>
tags withhref
attributes for search engines bots to follow them, - use semantic markup with structured data when relevant, and test it.
Refer to our SEO checklist for building SEO-ready search experiences.
HTML output
1
2
3
4
5
6
7
8
<div class="ais-MenuSelect">
<select class="ais-MenuSelect-select">
<option class="ais-Menu-option">
Apple (50)
</option>
<!-- more items -->
</select>
</div>