rc-slider vs react-compound-slider vs react-input-range vs react-range vs react-range-slider-input vs react-slider
React Slider Libraries
rc-sliderreact-compound-sliderreact-input-rangereact-rangereact-range-slider-inputreact-sliderSimilar Packages:

React Slider Libraries

These libraries provide various implementations of slider components for React applications, allowing developers to create customizable and interactive range input controls. They cater to different use cases, from simple value selection to complex multi-range sliders, enhancing user experience in forms and data visualization. Each library has its unique features, design principles, and performance characteristics, making them suitable for different scenarios in web development.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
rc-slider03,095173 kB2796 months agoMIT
react-compound-slider0620401 kB244 years agoMIT
react-input-range0715-1308 years agoMIT
react-range087674.3 kB202 years agoMIT
react-range-slider-input05746.7 kB44 months agoMIT
react-slider0914269 kB433 years agoMIT

Feature Comparison: rc-slider vs react-compound-slider vs react-input-range vs react-range vs react-range-slider-input vs react-slider

Customization

  • rc-slider:

    rc-slider offers extensive customization options, allowing developers to modify styles, handle shapes, and track appearances through CSS and props. This makes it suitable for applications needing a unique look and feel.

  • react-compound-slider:

    react-compound-slider provides a highly composable API, enabling developers to create custom components for handles, tracks, and labels, thus allowing for a tailored user experience and complex interactions.

  • react-input-range:

    react-input-range is designed for simplicity and ease of use, offering limited customization options that focus on functionality rather than extensive styling, making it ideal for quick implementations.

  • react-range:

    react-range emphasizes performance and accessibility, providing basic customization through props while ensuring that the component remains lightweight and responsive across devices.

  • react-range-slider-input:

    react-range-slider-input allows for direct input alongside the slider, providing a straightforward way to customize the input fields but with limited styling options compared to others.

  • react-slider:

    react-slider is straightforward to customize with basic props for styling, making it easy to adapt to different designs without extensive configuration.

Accessibility

  • rc-slider:

    rc-slider includes keyboard navigation support and ARIA attributes, ensuring that it is accessible to users with disabilities, making it a good choice for inclusive applications.

  • react-compound-slider:

    react-compound-slider is built with accessibility in mind, providing proper roles and keyboard interactions, making it suitable for applications that prioritize user accessibility.

  • react-input-range:

    react-input-range offers basic accessibility features, but may require additional work to fully support all users, making it less ideal for highly accessible applications.

  • react-range:

    react-range focuses on accessibility, providing keyboard navigation and screen reader support, making it a strong candidate for applications that need to cater to all users.

  • react-range-slider-input:

    react-range-slider-input supports basic accessibility features, but may need further enhancements for comprehensive accessibility, depending on the project's requirements.

  • react-slider:

    react-slider provides basic accessibility features, but developers may need to implement additional ARIA roles and keyboard support for full compliance.

Performance

  • rc-slider:

    rc-slider is optimized for performance, handling large ranges efficiently without significant lag, making it suitable for applications with heavy data interactions.

  • react-compound-slider:

    react-compound-slider is designed for complex interactions but may have performance implications in highly dynamic scenarios, requiring optimization for best results.

  • react-input-range:

    react-input-range is lightweight and performs well for simple use cases, making it ideal for applications that do not require heavy data manipulation.

  • react-range:

    react-range is built with performance in mind, ensuring smooth interactions even on mobile devices, making it a great choice for performance-sensitive applications.

  • react-range-slider-input:

    react-range-slider-input maintains good performance for basic use cases but may not be as optimized for complex scenarios as other libraries.

  • react-slider:

    react-slider is lightweight and performs well, making it suitable for applications that require a simple slider without heavy overhead.

Learning Curve

  • rc-slider:

    rc-slider has a moderate learning curve due to its extensive customization options, which may require some time to fully understand and implement effectively.

  • react-compound-slider:

    react-compound-slider has a steeper learning curve because of its composable nature, requiring a good understanding of React concepts to utilize effectively.

  • react-input-range:

    react-input-range is beginner-friendly with a simple API, making it easy for new developers to implement and use without extensive knowledge of React.

  • react-range:

    react-range is straightforward to use with a focus on performance, making it accessible for developers of all skill levels.

  • react-range-slider-input:

    react-range-slider-input is easy to learn, especially for those familiar with input fields, making it a good choice for quick implementations.

  • react-slider:

    react-slider has a low learning curve, allowing developers to quickly integrate and customize the slider with minimal setup.

Use Cases

  • rc-slider:

    rc-slider is suitable for applications requiring highly customizable sliders, such as data visualization tools or interactive dashboards where visual appeal is important.

  • react-compound-slider:

    react-compound-slider is ideal for complex scenarios, such as multi-handle sliders for selecting ranges in finance or analytics applications where precision is key.

  • react-input-range:

    react-input-range works well for forms and simple applications where a basic range selection is needed without extensive customization.

  • react-range:

    react-range is perfect for mobile applications and scenarios where performance and accessibility are critical, such as e-commerce sites with filters.

  • react-range-slider-input:

    react-range-slider-input is best for forms where users need to input values directly alongside using a slider, such as in settings or configuration panels.

  • react-slider:

    react-slider is suitable for general use cases where a simple slider is needed, such as volume controls or brightness adjustments.

How to Choose: rc-slider vs react-compound-slider vs react-input-range vs react-range vs react-range-slider-input vs react-slider

  • rc-slider:

    Choose rc-slider for a highly customizable slider that supports both single and range sliders, with a wide array of props for fine-tuning appearance and behavior. It's ideal for applications requiring extensive customization and styling options.

  • react-compound-slider:

    Opt for react-compound-slider if you need a flexible and composable slider solution that allows for complex interactions and custom components. It is suitable for advanced use cases where you want to build a slider with multiple handles and custom UI elements.

  • react-input-range:

    Select react-input-range for a straightforward, easy-to-use slider that provides a simple API for single and range inputs. It is great for projects that require basic functionality without heavy customization, making it beginner-friendly.

  • react-range:

    Use react-range if you want a lightweight and performant slider that focuses on accessibility and mobile-friendliness. It is perfect for applications where performance and user experience on various devices are a priority.

  • react-range-slider-input:

    Choose react-range-slider-input when you need a slider that integrates seamlessly with input fields, allowing users to see and edit values directly. This library is beneficial for forms where both slider and input are required for precise value selection.

  • react-slider:

    Pick react-slider for a simple and flexible slider component that is easy to integrate and customize. It is suitable for projects that require a basic slider with minimal setup and good performance.

README for rc-slider

rc-slider

Slider UI component for React

NPM version npm download build status Codecov bundle size dumi

Install

rc-slider

Example

npm start and then go to http://localhost:8000

Online examples: https://slider.react-component.now.sh/

Usage

Slider

import Slider from 'rc-slider';
import 'rc-slider/assets/index.css';

export default () => (
  <>
    <Slider />
  </>
);

Range

Please refer to #825 for information regarding usage of Range. An example:

import Slider, { Range } from 'rc-slider';
import 'rc-slider/assets/index.css';

export default () => (
  <>
    <Slider range />
  </>
);

Compatibility

IE / Edge
IE / Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
Electron
Electron
IE11, Edgelast 2 versionslast 2 versionslast 2 versionslast 2 versions

API

createSliderWithTooltip(Slider | Range) => React.Component

An extension to make Slider or Range support Tooltip on handle.

const Slider = require('rc-slider');
const createSliderWithTooltip = Slider.createSliderWithTooltip;
const Range = createSliderWithTooltip(Slider.Range);

Online demo

After Range or Slider was wrapped by createSliderWithTooltip, it will have the following props:

NameTypeDefaultDescription
tipFormatter(value: number): React.ReactNodevalue => valueA function to format tooltip's overlay
tipPropsObject{
placement: 'top',
prefixCls: 'rc-slider-tooltip',
overlay: tipFormatter(value)
}
A function to format tooltip's overlay

Common API

The following APIs are shared by Slider and Range.

NameTypeDefaultDescription
classNamestring''Additional CSS class for the root DOM node
minnumber0The minimum value of the slider
maxnumber100The maximum value of the slider
idstring''Unique identifier for the component, used for accessibility
marks{number: ReactNode} or{number: { style, label }}{}Marks on the slider. The key determines the position, and the value determines what will show. If you want to set the style of a specific mark point, the value should be an object which contains style and label properties.
stepnumber or null1Value to be added or subtracted on each step the slider makes. Must be greater than zero, and max - min should be evenly divisible by the step value.
When marks is not an empty object, step can be set to null, to make marks as steps.
verticalbooleanfalseIf vertical is true, the slider will be vertical.
handle(props) => React.ReactNodeA handle generator which could be used to customized handle.
includedbooleantrueIf the value is true, it means a continuous value interval, otherwise, it is a independent value.
reversebooleanfalseIf the value is true, it means the component is rendered reverse.
disabledbooleanfalseIf true, handles can't be moved.
keyboardbooleantrueSupport using keyboard to move handlers.
dotsbooleanfalseWhen the step value is greater than 1, you can set the dots to true if you want to render the slider with dots.
onBeforeChangeFunctionNOOPonBeforeChange will be triggered when ontouchstart or onmousedown is triggered.
onChangeFunctionNOOPonChange will be triggered while the value of Slider changing.
onChangeCompleteFunctionNOOPonChangeComplete will be triggered when ontouchend or onmouseup is triggered.
minimumTrackStyleObjectplease use trackStyle instead. (only used for slider, just for compatibility , will be deprecate at rc-slider@9.x )
maximumTrackStyleObjectplease use railStyle instead (only used for slider, just for compatibility , will be deprecate at rc-slider@9.x)
handleStyleArray[Object] | Object[{}]The style used for handle. (both for slider(Object) and range(Array of Object), the array will be used for multi handle following element order)
trackStyleArray[Object] | Object[{}]The style used for track. (both for slider(Object) and range(Array of Object), the array will be used for multi track following element order)
railStyleObject{}The style used for the track base color.
dotStyleObject | (dotValue) => Object{}The style used for the dots.
activeDotStyleObject | (dotValue) => Object{}The style used for the active dots.

Slider

NameTypeDefaultDescription
defaultValuenumber0Set initial value of slider.
valuenumber-Set current value of slider.
startPointnumberundefinedTrack starts from this value. If undefined, min is used.
tabIndexnumber0Set the tabIndex of the slider handle.
ariaLabelForHandlestring-Set the aria-label attribute on the slider handle.
ariaLabelledByForHandlestring-Set the aria-labelledby attribute on the slider handle.
ariaRequiredboolean-Set the aria-required attribute on the slider handle.
ariaValueTextFormatterForHandle(value) => string-A function to set the aria-valuetext attribute on the slider handle. It receives the current value of the slider and returns a formatted string describing the value. See WAI-ARIA Authoring Practices 1.1 for more information.

Range

NameTypeDefaultDescription
defaultValuenumber[][0, 0]Set initial positions of handles.
valuenumber[]Set current positions of handles.
tabIndexnumber[][0, 0]Set the tabIndex of each handle.
ariaLabelGroupForHandlesArray[string]-Set the aria-label attribute on each handle.
ariaLabelledByGroupForHandlesArray[string]-Set the aria-labelledby attribute on each handle.
ariaValueTextFormatterGroupForHandlesArray[(value) => string]-A function to set the aria-valuetext attribute on each handle. It receives the current value of the slider and returns a formatted string describing the value. See WAI-ARIA Authoring Practices 1.1 for more information.
countnumber1Determine how many ranges to render, and multiple handles will be rendered (number + 1).
allowCrossbooleantrueallowCross could be set as true to allow those handles to cross.
pushableboolean or numberfalsepushable could be set as true to allow pushing of surrounding handles when moving a handle. When set to a number, the number will be the minimum ensured distance between handles. Example:
draggableTrackbooleanfalseOpen the track drag. open after click on the track will be invalid.

SliderTooltip

The Tooltip Component that keep following with content.

Development

npm install
npm start

Test Case

npm run test

Coverage

npm run coverage

License

rc-slider is released under the MIT license.