2.0.0 • Published 3 years ago

@yaireo/react-number-input v2.0.0

Weekly downloads
55
License
MIT
Repository
github
Last release
3 years ago

Converts an <input type"number"> to a nicely-printed locale-based string when the input field has no focus, and when it receives focus, the input field reverts back to type number so it could be edited easily.

Supports currency transformation (AKA money) based on Number.prototype.toLocaleString.

Install

npm i @yaireo/react-number-input -s

Example usage (with currency)

import NumberInput from '@yaireo/react-number-input'

const MyComponent = () => (
  <NumberInput localeOptions={{
    maximumFractionDigits:2,
    currency:"USD",
    style:"currency",
    currencyDisplay:"symbol"
    }}
  />
)

Props

PropTypeDefaultInfo
placeholderstring
namestring
inputModestring"decimal"MDN docs
onChangefunction
defaultValuenumber""
localeOptionsObjectMDN docs
2.0.0

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago