🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

react-input-slider

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-input-slider

React input slider component

6.0.1
latest
Source
npm
Version published
Weekly downloads
11K
-19.48%
Maintainers
1
Weekly downloads
 
Created
Source

react-input-slider

npm npm Build Status codecov styled with prettier

React slider component

Installation

yarn add react-input-slider
npm install react-input-slider --save

Storybook Demo

http://react-input-slider.caitouyun.com

Usage

import React from 'react';
import Slider from 'react-input-slider';

function App() {
  const [state, setState] = useState({ x: 10, y: 10 });

  return (
    <div>
      ({state.x}, {state.y})
      <Slider axis="xy" x={state.x} y={state.y} onChange={setState} />
      <Slider
        axis="x"
        x={state.x}
        onChange={({ x }) => setState(state => ({ ...state, x }))}
      />
      <Slider axis="y" y={state.y} onChange={({ y }) => setState(state => ({ ...state, y }))} />
    </div>
  );
}

Styling

v5 introduces a new styling api powered by emotion

<Slider
  styles={{
    track: {
      backgroundColor: 'blue'
    },
    active: {
      backgroundColor: 'red'
    },
    thumb: {
      width: 50,
      height: 50
    },
    disabled: {
      opacity: 0.5
    }
  }}
/>

Props

NameTypeDescriptionDefault
axisstringtype of slider ('x', 'y', 'xy')'x'
xnumbervalue of x50
xmaxnumbermax of x100
xminnumbermin of x0
ynumbervalue of y50
ymaxnumbermax of y100
yminnumbermin of y0
xstepnumberstep of x1
ystepnumberstep of y1
onChangefunctionhandleChangenull
onDragStartfunctionhandleDragStartnull
onDragEndfunctionhandleDragEndnull
disabledbooleaninput disabledfalse
xreversebooleanreverse on xfalse
yreversebooleanreverse on yfalse

License

MIT

Keywords

input

FAQs

Package last updated on 23 Jun 2021

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