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

22 lines (21 loc) 1.24 kB
import type { ReactNode, SyntheticEvent } from 'react'; import { type FieldValues, type Path, type Control, type RegisterOptions } from 'react-hook-form'; import { type RatingProps } from '@mui/material/Rating'; import type { FormLabelProps, FormHelperTextProps } from '../../types'; type InputRatingProps = Omit<RatingProps, 'name' | 'onChange' | 'error' | 'value' | 'defaultValue'>; export type RHFRatingProps<T extends FieldValues> = { fieldName: Path<T>; control: Control<T>; registerOptions?: RegisterOptions<T, Path<T>>; required?: boolean; onValueChange?: (newValue: number | null, event: SyntheticEvent<Element, Event>) => void; label?: ReactNode; showLabelAboveFormField?: boolean; formLabelProps?: FormLabelProps; helperText?: ReactNode; errorMessage?: ReactNode; hideErrorMessage?: boolean; formHelperTextProps?: FormHelperTextProps; } & InputRatingProps; declare const RHFRating: <T extends FieldValues>({ fieldName, control, registerOptions, required, onValueChange, label, showLabelAboveFormField, formLabelProps, helperText, errorMessage, hideErrorMessage, formHelperTextProps, ...rest }: RHFRatingProps<T>) => import("react/jsx-runtime").JSX.Element; export default RHFRating;