form-input-fields
Version:
A customizable form field components built with TypeScript
61 lines • 1.95 kB
TypeScript
import { FieldProps } from 'formik';
import { TextFieldProps } from '@mui/material';
export interface FormDropDownFieldProps {
/**
* Array of items to display in the dropdown
* Each item should have an `id` and `description` property
*/
items: Array<{
id: string | number;
description: string;
}>;
/**
* Whether to show a default "Select" option as the first item
* @default false
*/
addInputSelect?: boolean;
/**
* Text to display for the default "Select" option
* @default 'Select'
*/
selectText?: string;
/**
* Whether the field is required
* @default false
*/
required?: boolean;
/**
* Whether the field is disabled
* @default false
*/
disabled?: boolean;
/**
* Custom class name for the root element
*/
className?: string;
/**
* Helper text to display below the field
*/
helperText?: string;
/**
* Error state of the field
*/
error?: boolean;
/**
* Custom onChange handler
*/
onChange?: (value: any) => void;
/**
* Custom onBlur handler
*/
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
/**
* The variant to use for the MUI TextField ('standard', 'outlined', 'filled')
* @default 'standard'
*/
variant?: 'standard' | 'outlined' | 'filled';
}
type FormDropDownFieldComponentProps = FormDropDownFieldProps & FieldProps & Omit<TextFieldProps, 'value' | 'onChange' | 'onBlur' | 'name' | 'defaultValue' | 'onError' | 'onFocus' | 'InputProps' | 'select' | 'SelectProps'>;
export declare const FormDropDownField: ({ field, form, items, addInputSelect, selectText, required, disabled, className, helperText, error, onChange, onBlur, variant, ...props }: FormDropDownFieldComponentProps) => import("react/jsx-runtime").JSX.Element;
export {};
//# sourceMappingURL=FormDropDownField.d.ts.map