react-slider is an actively maintained React component designed for creating highly customizable range sliders. The current stable version is 2.0.6, with recent updates focusing on stability and compatibility across modern web environments. It supports both single and multiple handles, offers horizontal and vertical orientations, and includes accessibility features through props like `ariaLabel` and `ariaValuetext`. Key differentiators include built-in `ResizeObserver` support for dynamic slider resizing and a commitment to broad React compatibility, explicitly listing React 16, 17, and 18 as peer dependencies. The project demonstrates a consistent release cadence, regularly publishing patch updates for bug fixes and minor enhancements, with major versions introducing significant features and occasional breaking changes. It addresses common slider challenges such as mobile 'snap back' behavior and module resolution issues for modern JavaScript module systems.
npm install react-sliderVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates both single-handle and dual-handle (range) sliders with custom thumb and track rendering. It shows how to manage slider state using React hooks and includes basic inline styles for clarity and immediate visual feedback.
Review your project's build pipeline and development environment configurations. If encountering issues after upgrading to v2.x, consult the `react-slider` changelog or GitHub issues for potential migration guidance related to build tooling.
Ensure your project's build configuration (Webpack, Rollup, Vite) and `tsconfig.json` (for TypeScript) are correctly set up to handle ESM and dual package resolutions. Consider `"type": "module"` in your `package.json` for ESM projects or `"moduleResolution": "bundler"` in TypeScript 5+ for improved compatibility. Upgrade your bundler and Node.js versions if issues persist.
Upgrade to `react-slider@2.0.5` or a later version to ensure this specific mobile interaction bug is resolved and benefit from improved touch handling.
Upgrade `react-slider` to version `0.11.2` or higher to ensure compatibility with modern React ref syntax and prevent the `NaN` value bug.
If you are specifically on `react-slider@0.11.2`, downgrade to `0.11.1` or upgrade to `0.11.3` (or higher) which reverted the problematic arrow functions to ES5 syntax for broader compatibility.
Change your import statement from `import { Slider } from 'react-slider';` to the correct default import: `import Slider from 'react-slider';`Ensure that all value-related props (`min`, `max`, `value`, `defaultValue`) are explicitly numeric types. Use `parseInt()`, `parseFloat()`, or the unary plus operator (`+`) to convert string inputs to numbers.
Verify your bundler (Webpack, Rollup, Vite) configuration correctly handles ESM/CJS interoperability. For TypeScript, ensure `tsconfig.json` has `"moduleResolution": "bundler"` (TypeScript 5+) or `"node"`/`"nodenext"` (for older TS). Clear your `node_modules` and `package-lock.json`/`yarn.lock` and reinstall dependencies.