New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-number-steps-input-component

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-number-steps-input-component

[![Storybook](https://cdn.jsdelivr.net/gh/storybookjs/brand@master/badge/badge-storybook.svg)](https://matthiaskainer.github.io/react-number-steps-input-component/?path=/story/numericstepinput--heavinly-customized) ![Coverage](https://github.com/MatthiasK

latest
Source
npmnpm
Version
0.1.9
Version published
Maintainers
2
Created
Source

Numeric Input Step component

Storybook Coverage npm

npm install react-number-steps-input-component

Usage

<NumericStepInput 
    initialValue={45654}
    validate={parseInt}
    format={(val) => {
        var formatter = new Intl.NumberFormat("en-US", {
            style: "currency",
            currency: "USD",
        });
        return formatter.format(val);
    }}
    stepping={{
        size: 500,
        snap: true
    }}
    clearOnFocus
    onChanged={(val) => console.log("New Value", val)}
    renderDecrementButtonComponent={(props) => <button {...props}>-</button>}
    renderInputComponent={(props) => <input {...props} />}
    renderIncrementButtonComponent={(props) =>(props) => <button {...props}>+</button>} />
PropertyDescription
initialValueThe initial value for the input. After the value is passed, the component handles the state internally. If you want to change it from the outside, set the key for the component to indicate you want a new instance.
validateParses and validates the input as it is received. Per default, this is done for the range of integers. If you want for instance support floating point numbers, adjust the validator to your usecase
formatThe formatter will be applied when the user is not in the field, and display a formatted representation of the number
steppingThe increment/decrement behavior can be set via this property. For details see the number-steps library
clearOnFocusIf set (thus true), will clear the input field if the user clicks inside
onChangedIs triggered when the value in the input was changed. The format is { value: number, formattedValue : string }. Will be triggered only once the change is applied, i.e. not for every single character that is typed.
renderDecrementButtonComponent / renderIncrementButtonComponentPer default, the increment/decrement is a button element. You can also set your own, but it should inherit the properties of a button as this component expects them.
renderInputComponentPer default, the increment/decrement is an input element. You can also set your own, but it should inherit the properties of an input as this component expects them.

See it in use in the storybook here: https://matthiaskainer.github.io/react-number-steps-input-component/?path=/story/numericstepinput--heavinly-customized

Keywords

react

FAQs

Package last updated on 01 Oct 2019

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