Search code examples
javascriptreactjsreact-number-format

How can I disable react-number-format input


I'd like to disable react-number-format input, but this component doesn't have disabled property. How can I disable it?


Solution

  • disabled is working fine.

    I have placed 2 components, one without the disabled attribute and the other one with the disabled attribute and the result is the desired one.

      <NumberFormat
        value={111}
        thousandSeparator={true}
        prefix="$"
        className="some"
        inputmode="numeric"
      />
      <NumberFormat
        value={222}
        thousandSeparator={true}
        prefix="$"
        className="some"
        inputmode="numeric"
        disabled
      />
    

    Check this sandbox