# react-input-decimal

> A simple React input component to work with decimal values

Latest version **1.0.2** (published 2022-05-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-input-decimal
pnpm add react-input-decimal
yarn add react-input-decimal
bun add react-input-decimal
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-05-14 |
| First published | 2022-05-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 15 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Wallas Faria |
| Maintainers | wallasfaria |
| Keywords | react, mask, input mask, input masked, react input, react mask, react input mask, react mask input, input mask currency, react currency mask |

## Links

- npm: https://www.npmjs.com/package/react-input-decimal
- npm.io page: https://npm.io/package/react-input-decimal

## 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

- 1.0.2 (latest) — 2022-05-14
- 1.0.1 — 2022-05-14
- 1.0.0-qa — 2022-05-14

## README

# react-input-decimal

A simple React input component to work with decimal values.

## How to use

Install with npm
```bash
npm install react-input-decimal
```
Install with yarn
```
yarn add react-input-decimal
```

```tsx
import { useState } from 'react'
import { InputDecimal } from 'react-input-decimal'

export default function App() {
  const [value, setValue] = useState(0)
  const [maskedValue, setMaskedValue] = useState('0.00')

  return <>
    <InputDecimal
      value={value}
      onChangeValue={(value, maskedValue, event) => {
        setValue(value)
        setMaskedValue(maskedValue)
      }}
    />
    <pre>
      Value: {value}<br />
      Masked value: {maskedValue}
    </pre>
  </>
}
```

![img](https://raw.githubusercontent.com/WallasFaria/react-input-decimal/main/docs/assets/example-default.gif)

## Available props

| Prop        | Type | Description |
|-------------|------|-------------|
| `precision`   | number | (optional) default is 2 |
| `decimalSeparator` | `',' \| '.'` | (optional) default is `'.'` |
| `useThousandSeparator` | `boolean` | (optional) default is `true` |
| `align`   | `'right' \| 'left'` | (optional) default is `'right'` |

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