Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@gilbarbara/react-range-slider

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gilbarbara/react-range-slider

A range slider component for React

  • 0.7.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
271
decreased by-32.92%
Maintainers
1
Weekly downloads
 
Created
Source

react-range-slider

npm version CI Maintainability Test Coverage

A range slider component for React

View the demo

Installation

npm i @gilbarbara/react-range-slider

Usage

import React, { useState } from 'react';
import RangeSlider, { RangeSliderPosition, RangeSliderProps } from '@gilbarbara/react-range-slider';

export default function App() {
	const [x, setX] = useState(10);

	const handleChange = (position: RangeSliderPosition, props: RangeSliderProps) => {
		setX(position.x);
	};

	return <RangeSlider axis="x" x={x} onChange={handleChange} />;
}

Props

axis {'x' | 'y' | 'xy'} ▶︎x
Type of slider

x {number}
Use with axis x or xy

xMin {number} ▶︎0
Min value of X

xMax {number} ▶︎100
Max value of X

xStep {number} ▶︎1
Step of X

y {number}
Use with axis y or xy

yMin {number} ▶︎0
Min value of Y

yMax {number} ▶︎100
Max value of Y

yStep {number} ▶︎1
Step of Y

onAfterEnd {function}
It is called after the slider changed (click or drag)

onChange {function}
It is called for each step

onDragEnd {function}
It is called after dragging the thumb

Customization

You can customize the UI with a styles prop. Check out styles.ts for more information.

<RangeSlider
  ...
  styles={{
    height: '10px',
    trackBorderRadius: 0,
  }}
/>

License

MIT

Keywords

FAQs

Package last updated on 17 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc