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

See this widget in action

Preview this widget and its behavior.

About this widget

<RangeInput> is a widget to let users select a numeric range using minimum and maximum inputs.
You can also create your own UI with useRange.

Requirements

The attribute 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

JavaScript

Props

string
required
The name of the attribute in the .
JavaScript
number
The minimum value for the input. When not provided, the minimum value is automatically computed by Algolia from the data in the index.
JavaScript
number
The maximum value for the input. When not provided, the maximum value is automatically computed by Algolia from the data in the .
JavaScript
number
default:0
The number of digits to use after the decimal point.
JavaScript
Partial<RangeInputClassNames>
The CSS classes you can override and pass to the widget’s elements. It’s useful to style widgets with class-based CSS frameworks like Bootstrap or Tailwind CSS.
  • root. The root element of the widget.
  • noRefinementRoot. The root element when there are no refinements.
  • form. The form element.
  • label. Each label element.
  • input. Each input element.
  • inputMin. The minimum input element.
  • inputMax. The maximum input element.
  • separator. The separator element between inputs.
  • submit. The submit button.
JavaScript
Partial<RangeInputTranslations>
A mapping of keys to translation values.
  • separatorElementText. The text for the separator element between the minimum and maximum inputs.
  • submitButtonText. The text for the submit button.
JavaScript
React.ComponentProps<'div'>
Any <div> prop to forward to the root element of the widget.
JavaScript

Hook

React InstantSearch let you create your own UI for the <RangeInput> widget with useRange. Hooks provide APIs to access the widget state and interact with InstantSearch. The useRange Hook accepts parameters and returns APIs. It must be used inside the <InstantSearch> component.

Usage

First, create your React component:
JavaScript
Then, render the widget:
JavaScript

Parameters

Hooks accept parameters. You can either pass them manually or forward props from a custom component.
When passing functions to Hooks, ensure stable references to prevent unnecessary re-renders. Use useCallback() for memoization. Arrays and objects are automatically memoized.
string
required
The name of the attribute in the records.
JavaScript
number
The minimum value for the input. When not provided, the minimum value is automatically computed by Algolia from the data in the index.
JavaScript
number
The maximum value for the input. When not provided, the maximum value is automatically computed by Algolia from the data in the index.
JavaScript
number
default:0
The number of digits to use after the decimal point.
JavaScript

APIs

Hooks return APIs, such as state and functions. You can use them to build your UI and interact with React InstantSearch.
RangeBoundaries
The current value for the refinement, with start[0] as the minimum value and start[1] as the maximum value.
TypeScript
Range
The current available value for the range.
TypeScript
boolean
Whether users can refine further.
(rangeValue: RangeBoundaries) => void
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.
JavaScript
(eventType: string, facetValue: string, eventName?: string) => void
Sends an event to the Insights middleware.

Example

Last modified on July 22, 2026