UNPKG

dgz-ui-shared

Version:

Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript, dgz-ui library

24 lines 1.38 kB
import { FormItemProps, InputProps } from 'dgz-ui/form'; import { FieldValues } from 'react-hook-form'; /** * Props for the MyInput component. * @template TFieldValues - The type of the form values. */ export type MyInputProps<TFieldValues extends FieldValues> = FormItemProps<TFieldValues> & InputProps; /** * MyInput is a form-aware input field that integrates with react-hook-form. * Works in both controlled (with control/name) and uncontrolled modes. * * @template TFieldValues - Form values type used by react-hook-form. * @param control - The `react-hook-form` control object. * @param name - The name of the field in `react-hook-form`. * @param label - The label to display for the input. * @param required - Whether the field is required. * @param className - Custom CSS class name. * @param rules - The `react-hook-form` validation rules. * @param floatingError - Whether to show the error message in a floating container. * @param props - Input and form item props. * @returns {JSX.Element | null} An input field with form integration and validation, or null if name/control are missing */ export declare const MyInput: <TFieldValues extends FieldValues>({ control, name, label, required, className, rules, floatingError, ...props }: MyInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element | null; //# sourceMappingURL=MyInput.d.ts.map