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

31 lines (30 loc) 1.43 kB
import { type ReactNode } from 'react'; import { type FieldValues, type Path, type Control, type RegisterOptions } from 'react-hook-form'; import { type IColor } from 'react-color-palette'; import type { FormLabelProps, FormHelperTextProps } from '../../types'; import 'react-color-palette/css'; type ColorFormat = keyof IColor; export type RHFColorPickerProps<T extends FieldValues> = { fieldName: Path<T>; control: Control<T>; registerOptions?: RegisterOptions<T, Path<T>>; value?: string; valueKey?: ColorFormat; defaultColor?: string; excludeAlpha?: boolean; required?: boolean; height?: number; hideAlpha?: boolean; hideInput?: (keyof IColor)[] | boolean; onValueChange?: (color: IColor) => void; disabled?: boolean; label?: ReactNode; showLabelAboveFormField?: boolean; formLabelProps?: FormLabelProps; helperText?: ReactNode; errorMessage?: ReactNode; hideErrorMessage?: boolean; formHelperTextProps?: FormHelperTextProps; }; declare const RHFColorPicker: <T extends FieldValues>({ fieldName, control, registerOptions, value, valueKey, defaultColor, excludeAlpha, required, hideInput, onValueChange, disabled, label, showLabelAboveFormField, formLabelProps, helperText, errorMessage, hideErrorMessage, formHelperTextProps, height, ...otherProps }: RHFColorPickerProps<T>) => import("react/jsx-runtime").JSX.Element; export default RHFColorPicker;