Novices Plagiarizing Mozart
    Have ideas to improve npm?Join in the discussion! »

    react-shassain-numeric

    1.0.2 • Public • Published

    react-shassain-numeric

    npm npm

    A react component for formatted number form fields

    react-shassain-numeric is a wrapper component for autonumeric.

    Installition

    npm install react-shassain-numeric --save

    Usage

    import ShassainNumeric from 'react-shassain-numeric';
     
    export function USDMoneyInput(props){
      const { value } = props; // number typed
      return (
        <ShassainNumeric
          value={value}
          currencySymbol="$"
          minimumValue="0"
          decimalCharacter="."
          digitGroupSeparator=""
          onChange={(event, value)=>{
            console.log(event.target.value); // '1,234.5 $'
            console.log(value); // 1234.5
          }}
        />
      );
    }
     
    // You can use predefinedOptions
    import { predefinedOptions } from 'react-shassain-numeric';
     
    export function PossitiveUSDMoneyInput(props){
      const { value } = props; // number typed
      return (
        <ShassainNumeric
          value={value}
          preDefined={predefinedOptions.dollarPos}
          onChange={(e, value)=> this.setState({ value })}
        />
      );
    }
     
    // if you want to store value as string typed
    export function NumberInput(props){
      const { value } = props; // string typed
      return (
        <ShassainNumeric
          value={value}
          outputFormat="string"
          onChange={(e, value)=> this.setState({ value })}
        />
      );
    }

    Install

    npm i react-shassain-numeric

    DownloadsWeekly Downloads

    0

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    33.1 kB

    Total Files

    15

    Last publish

    Collaborators

    • avatar