3

I am trying to format in input field using a Cleave component which groups the raw input value into thousands. I am using React JS.

<InputGroup>
    <Cleave
        id="format_number_input"
        value={this.props.NumberInput}
        className="form-control"
        options={{
            numeral: true,
            numeralThousandsGroupStyle: "thousand",
            rawValueTrimPrefix: true
        }}
        onChange={this.props.handleOnChange}
    />
</InputGroup>

My problem is that I want to allow many digits after the decimal point, but the input field prevents anything more than two decimal places, i.e. I want to be able to input 123.000001, but the field only allows the value up to two decimal places: 123.00.

Is this behaviour intrinsic to the Cleave component, and is there some way around this? The component's source is here: https://github.com/nosir/cleave.js

Richard Chambers
  • 16,643
  • 4
  • 81
  • 106

0 Answers0