1

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

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

0

For anyone wondering you can also show the number just as text. You can use the displayType prop.

  <NumberFormat
    value={69}
    thousandSeparator={true}
    prefix="$"
displayType="text"
  />

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.