Skip to main content
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

Use this React Hook to filter search results within a numeric range. You can build custom slider components with this Hook. To display a number range input, use the RangeInput widget instead.

Requirements

The attribute provided to this Hook must be a facet, which you can declare in the dashboard or using the attributesForFaceting setting. The attribute values must be numbers, not strings.

Examples

Range slider with React Spectrum

Open CodeSandbox

Run and edit the useRange example in CodeSandbox.

Range slider with Radix UI

Open CodeSandbox

Run and edit the useRange example in CodeSandbox.

Parameters

string
required
The name of the numeric attribute in your Algolia to use for refining the search.
JavaScript
number
The minimum value for the range.If not set, Algolia determines it based on the lowest value of the attribute prop.
JavaScript
number
The maximum value for the range. If not set, Algolia determines it based on the highest value of the attribute prop.
JavaScript
number
default:0
The number of decimal places to use when rounding values. Use negative values to round to powers of 10.
JavaScript

Returns

[number, number]
The selected range for the refinement, where start[0] is the lower bound and start[1] is the higher bound.
{ min: number, max: number }
The possible bounds based on the attribute’s values.
boolean
Whether the search can be refined.
(range: [number, number]) => void
Sets the range used to filter results. Use undefined to remove a bound or allow it to be unbounded. Both values are optional and default to the upper and lower bounds.
(eventType: string, facetValue: string, eventName?: string) => void
Sends an event to the Insights API.
Last modified on July 22, 2026