@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
20 lines (19 loc) • 1.3 kB
TypeScript
import { type ReactNode } from 'react';
import { type FieldValues, type Path, type Control, type RegisterOptions } from 'react-hook-form';
import { type DateTimePickerProps, type PickerValidDate, type DateTimeValidationError, type PickerChangeHandlerContext } from '@mui/x-date-pickers';
import type { FormLabelProps, FormHelperTextProps } from '../../types';
export type RHFDateTimePickerProps<T extends FieldValues> = {
fieldName: Path<T>;
control: Control<T>;
registerOptions?: RegisterOptions<T, Path<T>>;
required?: boolean;
onValueChange?: (newValue: PickerValidDate, context: PickerChangeHandlerContext<DateTimeValidationError>) => void;
showLabelAboveFormField?: boolean;
formLabelProps?: FormLabelProps;
helperText?: ReactNode;
errorMessage?: ReactNode;
hideErrorMessage?: boolean;
formHelperTextProps?: FormHelperTextProps;
} & Omit<DateTimePickerProps<PickerValidDate>, 'value' | 'onChange'>;
declare const RHFDateTimePicker: <T extends FieldValues>({ fieldName, control, registerOptions, required, onValueChange, label, showLabelAboveFormField, formLabelProps, helperText, errorMessage, hideErrorMessage, formHelperTextProps, ...rest }: RHFDateTimePickerProps<T>) => import("react/jsx-runtime").JSX.Element;
export default RHFDateTimePicker;