API Reference
/
Vue InstantSearch Widgets
/
ais-numeric-menu
Apr. 24, 2019
ais-numeric-menu
Widget signature
<ais-numeric-menu attribute="string" :items="object[]" // Optional parameters :transform-items="function" :class-names="object" />
About this widget
The ais-numeric-menu
widget displays a list of numeric filters in a list. Those numeric filters are pre-configured when creating the widget.
Requirements
The values inside the attribute must be numbers, not strings.
Examples
Copy
1
2
3
4
5
6
7
8
9
10
<ais-numeric-menu
attribute="price"
:items="[
{ label: 'All' },
{ label: '<= 10$', end: 10 },
{ label: '10$ - 100$', start: 10, end: 100 },
{ label: '100$ - 500$', start: 100, end: 500 },
{ label: '>= 500$', start: 500 },
]"
/>
Props
attribute
|
type: string
Required
The name of the attribute in the record. |
||
Copy
|
|||
items
|
type: object[]
Required
A list of all the options to display, with:
|
||
Copy
|
|||
transform-items
|
type: function
default: x => x
Optional
Modifies the items being displayed, for example, to filter or sort them. It takes items as argument and expects them back in return. |
||
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
With each item an
|
||
Copy
|
HTML output
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<div class="ais-NumericMenu">
<ul class="ais-NumericMenu-list">
<li class="ais-NumericMenu-item ais-NumericMenu-item--selected">
<label class="ais-NumericMenu-label">
<input
class="ais-NumericMenu-radio"
type="radio"
name="NumericMenu"
checked
/>
<span class="ais-NumericMenu-labelText">All</span>
</label>
</li>
<li class="ais-NumericMenu-item">
<label class="ais-NumericMenu-label">
<input
class="ais-NumericMenu-radio"
type="radio"
name="NumericMenu"
/>
<span class="ais-NumericMenu-labelText">Less than 500</span>
</label>
</li>
</ul>
</div>