Skip to main content

RHFPasswordInput

RHFPasswordInput an enhanced version of the TextField component, designed specifically for password input on signup and login pages. This component allows users to toggle password visibility, offering a more user-friendly experience when entering credentials.

Usage

import { RHFPasswordInput, RHFPasswordInputProps } from '@nish1896/rhf-mui-components';

RHFPasswordInput also requires just 3-4 essential props to render a fully functional field.

<RHFPasswordInput
fieldName="password"
register={register}
errorMessage={errors?.password?.message}
/>

Examples

API

The RHFPasswordInputProps interface extends TextFieldProps and includes additional options for password handling and input customization.

NameTypeRequiredDescription
fieldNamestringReact Hook Form requires name as a key for the registration process.
registerUseFormRegisterThe register option yielded on calling the useForm hook.
registerOptionsRegisterOptionsRegister options if using react-hook-form without any validation libraries like yup or Joi.
onValueChange(e: ChangeEvent) => voidAn optional callback function when the value of a field changes. The changed value can be obtained from e.target.value.
showLabelAboveFormFieldbooleanRender form label above the form field in FormLabel component.
formLabelPropsFormLabelPropsFormLabelProps to customise FormLabel component for a field. Multiple fields can be configured using the ConfigProvider component.
showPasswordIconReactNodeIcon component to show password, such as VisibilityIcon from @mui/icons-material/Visibility.
hidePasswordIconReactNodeIcon component to hide password text, such as VisibilityOffIcon from @mui/icons-material/VisibilityOff.
errorMessageReactNodeError message to be shown for a field in FormHelperText component.
hideErrorMessagebooleanPrevent replacing of form HelperText by error message during validation trigger.
formHelperTextPropsFormHelperTextPropsFormHelperTextProps to customise FormHelperText component for a field. Multiple fields can be configured using the ConfigProvider component.