dohomi / react-hook-form-mui

Material-UI form components ready to use with react-hook-form
https://react-hook-form-material-ui.vercel.app
MIT License
562 stars 111 forks source link

Issue with setting min/max props on TextFieldElement #324

Closed aniket-teltumbade-au9 closed 1 month ago

aniket-teltumbade-au9 commented 1 month ago

Duplicates

Latest version

Current behavior 😯

When using the TextFieldElement component from react-hook-form-mui, I'm trying to set min and max constraints for numeric input using InputProps, inputProps, and passing them directly as props. However, none of these methods are working, and the field does not enforce the min and max values.

Expected behavior 🤔

The TextFieldElement should accept min and max constraints and enforce them for numeric input, preventing users from entering values outside the specified range.

Steps to reproduce 🕹

  1. Install the react-hook-form-mui package.
  2. Use the TextFieldElement component in a form.
  3. Try to set min and max constraints using different methods (InputProps, inputProps, direct props).
  4. Observe that the field does not enforce these constraints.
aniket-teltumbade-au9 commented 1 month ago

validate={min, max} prop solved it