import type {FunctionComponent, HTMLAttributes, HTMLProps} from 'react' import {useId} from 'react' import {Label} from '@/components/ui/label' import {useFormContext} from 'react-hook-form' import {cn} from '@/lib/utils' import FormError from '@/components/form/formError' import {Textarea} from '@/components/ui/textarea' interface FormInputProps extends HTMLProps { name: string label?: string DecorationLeft?: FunctionComponent> DecorationRight?: FunctionComponent> } /** * A reusable form input component that integrates with react-hook-form. * * @param label The label for the input field. * @param name The name of the input field, used for form registration. * @param className Optional additional CSS classes for styling the input container. * @param decorationLeft * @param inputProps Additional properties for the input element, such as type, placeholder, etc. * @constructor */ const FormTextarea: FunctionComponent = ({ label, name, className, DecorationLeft, DecorationRight, ...inputProps }) => { const form = useFormContext() const id = useId() return (
{DecorationRight && (
)}