This is the React InstantSearch v7 documentation.
If you’re upgrading from v6, see the upgrade guide.
If you were using React InstantSearch Hooks,
this v7 documentation applies—just check for necessary changes.
To continue using v6, you can find the archived documentation.
Signature
Import
JavaScript
About this Hook
React Hook to filter search results within a numeric range. With this Hook, you can build your own slider components. To display an input for a range of numbers, use the<RangeInput>
widget instead.
Requirements
Theattribute
provided to the widget must be in attributes for faceting,
either on the dashboard or using the attributesForFaceting
parameter with the API.
The values of the attribute must be numbers, not strings.
Examples
Range slider with React Spectrum
Range slider with Radix UI
Parameters
The name of a numeric attribute in your Algolia records which should be used for refining the search.
JavaScript
The minimum value for the input.When not provided, Algolia determines the minimum from the values of the attribute you specified in the
attribute
prop.JavaScript
The maximum value for the input.When not provided,
Algolia determines the maximum from the values of the attribute you specified in the
attribute
prop.JavaScript
The number of digits after the decimal point to use.Use a negative value to round values to powers of 10.For example, a precision of -2 would round a number to the nearest hundred,
while a precision of -3 would round it to the nearest thousand.
JavaScript
Returns
The selected range for the refinement, with
start[0]
as the lower bound and start[1]
as the higher bound.The highest and lowest possible bounds for the range.
Whether the search can be refined.
Sets a range to filter the results on.Both values are optional, and default to the higher and lower bounds.
You can use
undefined
to remove a previously set bound or to set an infinite bound.Sends an event to the Insights API.