diff --git a/app/components/forms.tsx b/app/components/forms.tsx index ea1d989..b8c99b4 100644 --- a/app/components/forms.tsx +++ b/app/components/forms.tsx @@ -4,6 +4,7 @@ import { type FieldName, useInputControl } from "@conform-to/react" import { useId } from "react" import { cn } from "~/utils" import { Checkbox } from "~/components/ui/checkbox" +import { Textarea } from "./ui/textarea" export const Field = ({ inputProps, @@ -98,6 +99,36 @@ export const FieldCheckbox = ({ ) } +export function TextareaField({ + labelProps, + textareaProps, + errors, + className, +}: { + labelProps: React.LabelHTMLAttributes + textareaProps: React.TextareaHTMLAttributes + errors?: ListOfErrors + className?: string +}) { + const fallbackId = useId() + const id = textareaProps.id ?? textareaProps.name ?? fallbackId + const errorId = errors?.length ? `${id}-error` : undefined + return ( +
+