UNPKG

@nish1896/rhf-mui-components

Version:

A suite of 20+ reusable Material UI components for React Hook Form to minimize your time and effort in creating and styling forms

18 lines (17 loc) 1.03 kB
import { type ReactNode, type ChangeEvent } from 'react'; import { type FieldValues, type Path, type Control, type RegisterOptions } from 'react-hook-form'; import type { FormControlLabelProps, FormHelperTextProps, CheckboxProps } from '../../types'; export type RHFCheckboxProps<T extends FieldValues> = { fieldName: Path<T>; control: Control<T>; registerOptions?: RegisterOptions<T, Path<T>>; onValueChange?: (isChecked: boolean, event: ChangeEvent<HTMLInputElement>) => void; label?: ReactNode; formControlLabelProps?: FormControlLabelProps; helperText?: ReactNode; errorMessage?: ReactNode; hideErrorMessage?: boolean; formHelperTextProps?: FormHelperTextProps; } & CheckboxProps; declare const RHFCheckbox: <T extends FieldValues>({ fieldName, control, registerOptions, onValueChange, label, formControlLabelProps, helperText, errorMessage, hideErrorMessage, formHelperTextProps, ...rest }: RHFCheckboxProps<T>) => import("react/jsx-runtime").JSX.Element; export default RHFCheckbox;