react-input icon indicating copy to clipboard operation
react-input copied to clipboard

Add Option To Prevent Negative Values

Open mattsputnikdigital opened this issue 1 year ago • 1 comments

As the title says it would be a nice feature to have an option to block the input of negative values / the minus sign.

mattsputnikdigital avatar Jan 14 '25 01:01 mattsputnikdigital

As the documentation suggests, you can specify the signDisplay property with a value of "never".

import { useNumberFormat } from "@react-input/number-format";

export default function Input() {
  const inputRef = useNumberFormat({
    signDisplay: "never",
  });

  return <input ref={inputRef} />;
}

GoncharukBro avatar Feb 11 '25 04:02 GoncharukBro