react-hook-form-bound multiline text field. Wraps the @uxf/ui/textarea primitive and manages its value, isInvalid, and helperText from form state.
Use @uxf/form/textarea for a multiline text field inside a @uxf/form form — it registers the field with react-hook-form via control/name and renders validation errors automatically. For a standalone, manually-controlled textarea (outside a form), use the @uxf/ui/textarea twin directly.
import { Form } from "@uxf/form/form";
import { Textarea } from "@uxf/form/textarea";
import { useForm } from "react-hook-form";
interface FormData {
note: string;
}
function Example() {
const formApi = useForm<FormData>({ defaultValues: { note: "" } });
return (
<Form formApi={formApi} id="example" onSubmit={(values) => console.log(values)}>
<Textarea control={formApi.control} isRequired label="Note" name="note" placeholder="Enter a note" />
</Form>
);
}
Value is string | null (TextareaValue), rendered as an empty string when null.
TextareaProps<FormData> = ControlProps<FormData> + the visual props of the @uxf/ui/textarea twin (minus the ones this field manages: isFocused, isInvalid, name, onChange, value) + the props below.
| Prop | Type | Default | Description |
|---|---|---|---|
control |
Control<FormData> |
— | Required. The control from useForm. |
name |
FieldPath<FormData> |
— | Required. Field path in the form values. |
rules |
RegisterOptions |
— | Extra react-hook-form rules; merged with the built-in required rule below. |
shouldUnregister |
boolean |
— | Unregister the field (drop its value) on unmount. |
isRequired |
boolean |
false |
Adds a required rule and the required indicator. |
requiredMessage |
string |
localized | Message for the required rule. |
onChange |
(value: string, event) => void |
— | Called after the field value updates. |
All other props (label, placeholder, rows, maxLength, minLength, disableAutoHeight, helperText, hiddenLabel, autoComplete, …) are forwarded to the twin — see @uxf/ui/textarea.
isRequired adds a required rule; override its message with requiredMessage (default localized via key uxf-form-textarea:validation.required).rules; the field-level error is shown as the twin's helperText and sets isInvalid.Form — it reads the form context (formId, and inherits isDisabled / isReadOnly) and needs a react-hook-form control.@uxf/ui/textarea, so include that component's stylesheet(s) and the @uxf/ui token layer — see @uxf/ui/textarea.@uxf/ui/textarea