ais-range-input
<ais-range-input attribute="string" // Optional parameters :min="number" :max="number" :precision="number" :class-names="object" />
About this widget
The ais-range-input
widget allows a user to select a numeric range using a minimum and maximum input.
Requirements
The attribute provided to the widget 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 numbers, not strings.
Examples
1
<ais-range-input attribute="price" />
Props
attribute
|
type: string
Required
The name of the attribute in the record. |
||
Copy
|
|||
min
|
type: number
Optional
The minimum value for the input. When not provided, the minimum value is automatically computed by Algolia from the data in the index. |
||
Copy
|
|||
max
|
type: number
Optional
The maximum value for the input. When not provided, the maximum value is automatically computed by Algolia from the data in the index. |
||
Copy
|
|||
precision
|
type: number
default: 0
Optional
The number of digits after the decimal point to use. |
||
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. Note that when you implement this slot, none of the other slots will change the output, as the default slot surrounds them. Scope
|
||
Copy
|
|||
minLabel
|
The slot to override the DOM output for the label of the minimum value. |
||
Copy
|
|||
maxLabel
|
The slot to override the DOM output for the label of the maximum value. |
||
Copy
|
|||
submitLabel
|
The slot to override the DOM output for the label of the submit button. |
||
Copy
|
|||
separator
|
The slot to override the DOM output for the separator beteween the inputs. |
||
Copy
|
HTML output
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<div class="ais-RangeInput">
<form class="ais-RangeInput-form">
<label class="ais-RangeInput-label">
<input
class="ais-RangeInput-input ais-RangeInput-input--min"
type="number"
placeholder=""
step="1"
/>
</label>
<span class="ais-RangeInput-separator">to</span>
<label class="ais-RangeInput-label">
<input
class="ais-RangeInput-input ais-RangeInput-input--max"
type="number"
placeholder=""
step="1"
/>
</label>
<button class="ais-RangeInput-submit" type="submit">Go</button>
</form>
</div>