Text Area Field
TextAreaField is a flexible reusable textarea component for Shaddy Form.
TextAreaField
is a reusable textarea component for Shaddy Form. It supports labels, required state, icons, loading indicators, custom actions, auto-resizing, and more. Use it inside a Shaddy Form to collect multi-line user input with validation.
Installation
pnpm dlx shadcn@latest add https://shaddy-docs.vercel.app/r/text-area-field
Props
Name | Type | Default | Description |
---|---|---|---|
name | string (from react-hook-form Path) | required | The field name (must match your form schema). |
label | string | The label displayed above the textarea. | |
required | boolean | false | Marks the field as required. |
placeholder | string | Placeholder text for the textarea. | |
resizable | boolean | false | If false , disables manual resizing. |
autoResize | boolean | false | If true , textarea auto-grows with content. |
maxHeight | number | Maximum height for the textarea (in px). | |
minHeight | number | Minimum height for the textarea (in px). | |
action | () => void | Optional action button on the right (e.g., clear/reset). | |
Icon | ReactNode | Icon to display on the right side or inside the action button. | |
loading | boolean | Shows a loading spinner on the right when true. | |
className | string | Additional CSS classes for the field container. | |
inputClassName | string | Additional CSS classes for the textarea element. | |
iconClassName | string | Additional CSS classes for the icon or action button. |
Usage
<ShaddyForm>
<TextAreaField
name="summary"
label="Summary"
placeholder="Write something..."
required
autoResize
minHeight={80}
maxHeight={300}
/>
</ShaddyForm>
Notes
- The
action
prop adds a button on the right (e.g., for clearing the field). IfIcon
is provided, it will be shown inside the action button; otherwise, a default X icon is used. - If
loading
is true, a loading spinner appears on the right.