# 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 version **0.1.9** (published 2019-10-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-number-steps-input-component
pnpm add react-number-steps-input-component
yarn add react-number-steps-input-component
bun add react-number-steps-input-component
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.9 |
| Published | 2019-10-01 |
| First published | 2019-08-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 212.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Matthias Kainer |
| Maintainers | 326, matkainer |
| Keywords | react, typescript, render props, number input, steps |

## Links

- npm: https://www.npmjs.com/package/react-number-steps-input-component
- Repository: https://github.com/MatthiasKainer/react-number-steps-input-component
- Homepage: https://github.com/MatthiasKainer/react-number-steps-input-component#readme
- Issues: https://github.com/MatthiasKainer/react-number-steps-input-component/issues
- npm.io page: https://npm.io/package/react-number-steps-input-component

## Dependencies (3)

- [react](https://npm.io/package/react.md) ^16.9.0
- [react-dom](https://npm.io/package/react-dom.md) ^16.9.0
- [number-steps](https://npm.io/package/number-steps.md) ^1.0.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.9 (latest) — 2019-10-01
- 0.1.5 — 2019-08-12
- 0.1.4 — 2019-08-12
- 0.1.3 — 2019-08-12
- 0.1.2 — 2019-08-11
- 0.1.0 — 2019-08-10

## README

# Numeric Input Step 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/MatthiasKainer/react-number-steps-input-component/raw/master/badge.svg?sanitize=true)
[![npm](https://img.shields.io/npm/v/react-number-steps-input-component)](https://www.npmjs.com/package/react-number-steps-input-component)


`npm install react-number-steps-input-component`

Usage 

```jsx
<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>} />
```

| Property  | Description  |
|---|---|
| **initialValue** | The 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. |
| **validate**  | Parses 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 |
| **format**  | The formatter will be applied when the user is not in the field, and display a formatted representation of the number |
| **stepping** | The increment/decrement behavior can be set via this property. For details see the [number-steps](https://github.com/MatthiasKainer/number-steps) library | 
| **clearOnFocus** | If set (thus true), will clear the input field if the user clicks inside | 
| **onChanged** | Is 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** / **renderIncrementButtonComponent**  | Per 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. | 
| **renderInputComponent** | Per 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

---
_Source: https://npm.io/package/react-number-steps-input-component · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
