use-format-amount-input

0.3.0 • Public • Published

useFormatAmountInput

Format amount, price, number fields in react

Installation

yarn add use-format-amount-input

or if npm is your thing, do:

npm i use-format-amount-input

Usage

import {useFormatAmountInput} from "use-format-amount-input"

const Component = () => {

    const {amount, handleAmountChange, strippedAmount} = useFormatAmountInput({decimalPlaces: 3, separator:","})

    return <form>
    <input type="text" name="amount" value={amount} onChange={handleAmountChange} />
    <form>
}

Params

You can pass an optional value to useFormatInput() which represents the number of decimal places you want to allow the user to be able to enter

/use-format-amount-input/

    Package Sidebar

    Install

    npm i use-format-amount-input

    Weekly Downloads

    0

    Version

    0.3.0

    License

    MIT

    Unpacked Size

    6.49 kB

    Total Files

    5

    Last publish

    Collaborators

    • aremu-smog