0.1.6 • Published 2 years ago

react-ticker-input v0.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

React Ticker Input

A minimal reactjs package to render a number input with ticker selectors. 🔥🔥

react ticker input

Live Playground

To see the react number input in action, click here.

OR

To run that demo on your computer:

Getting Started

Import Component

    import Ticker from 'react-ticker-input'

Usage

This is the minimum code required to get started with react-ticker-input. Other required and non-required props are documented below.

    import React, { useState } from 'react'
    import Ticker from 'react-ticker-input'

    const App = () => {
    
        const [value, setValue] = useState(10)
        return <Ticker 
            value={value}
            setValue={setValue}
        />
    }

    export default App

Supported Props

namedescriptiondefaultrequiredtype
valuevalue of the controlled input (should be a component state)0truenumber
setValuefunction called when value changes with updated valueundefinedtruefunction ⎮ undefined
minminimum value of the input0falsenumber
maxmaximum value of the input100falsenumber
majorGapgap between taller (prominent) ticks10falsenumber
minorGapgap between smaller ticks2falsenumber
hideTextif true, hides the value textfalsefalseboolean
textFormatterfunction that takes in the value and can be used to format itundefinedfalsefunction ⎮ undefined
throttleScrollif true, applies throttling while scroll improves performance, decreases UXfalsefalseboolean
throttleTimeoutdelay for scroll throttle250falsenumber
stickMaxWidthmax width between two sticks in vw4falsenumber
knobClassNameclassName for the knob pointer''falsestring
containerClassNameclassName for the outermost container''falsestring
textClassNameclassName for the top text''falsestring
tickerClassNameclassName for the container that contains all the sticks''falsestring
tickClassNameclassName for all the sticks (tall and small both)''falsestring
largeTickClassNameclassName for the taller sticks''falsestring
tickLabelClassNameclassName for the label text displayed beneath taller sticks''falsestring

Other thing that should be taken care of is that majorGap, the difference between max and min, both should be a multiple of the minGap.

0.1.4

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago