@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.42 kB
TypeScript
import { type ReactNode } from 'react';
import { type FieldValues, type Path, type Control, type RegisterOptions } from 'react-hook-form';
import { type TextFieldProps } from '@mui/material/TextField';
import type { FormLabelProps, FormHelperTextProps, MuiChipProps } from '../../types';
type TextFieldInputProps = Omit<TextFieldProps, 'name' | 'value' | 'defaultValue' | 'onChange' | 'error' | 'multiline' | 'rows' | 'minRows' | 'maxRows' | 'FormHelperTextProps'>;
export type RHFTagsInputProps<T extends FieldValues> = {
fieldName: Path<T>;
control: Control<T>;
registerOptions?: RegisterOptions<T, Path<T>>;
onValueChange?: (tags: string[]) => void;
showLabelAboveFormField?: boolean;
formLabelProps?: FormLabelProps;
errorMessage?: ReactNode;
hideErrorMessage?: boolean;
formHelperTextProps?: FormHelperTextProps;
ChipProps?: MuiChipProps;
limitTags?: number;
getLimitTagsText?: (hiddenTags: number) => ReactNode;
} & TextFieldInputProps;
declare const RHFTagsInput: <T extends FieldValues>({ fieldName, control, registerOptions, onValueChange, label, showLabelAboveFormField, formLabelProps, required, helperText, errorMessage, hideErrorMessage, formHelperTextProps, ChipProps, disabled, sx: muiTextFieldSx, variant, limitTags, getLimitTagsText, slotProps, ...rest }: RHFTagsInputProps<T>) => import("react/jsx-runtime").JSX.Element;
export default RHFTagsInput;