sidebar_position | sidebar_label | title | description |
---|---|---|---|
2 |
Number Input |
RHFNumberInput |
RHFNumberInput is a specialized version of RHFTextField, designed to accept only integer or decimal values as input. |
import { RHFNumberInputPropsTable } from '@site/src/page-components'; import { AvailabilityBanner } from '@site/src/components'; import NewImg from '@site/static/img/new.png';
RHFNumberInput is an enhanced version of the TextField component which accepts only integer or float values. It retains the core functionality, styling options, and flexibility of the TextField, while seamlessly integrating with react-hook-form for number-specific input handling.
import RHFNumberInput, { RHFNumberInputProps } from '@nish1896/rhf-mui-components/mui/number-input';
To render a fully functional RHFNumberInput
, you only need 3-4 essential props.
<RHFNumberInput
fieldName="age"
control={control}
errorMessage={errors?.age?.message}
/>
The RHFNumberInputProps
interface extends TextFieldProps
and includes the following additional props: