Textarea Field
Multi-line text input component with optional tooltip. Built on shadcn InputGroup for enhanced UI.
npx shadcn@latest add https://shuip.plvo.dev/r/rhf-textarea-field.json
Preview
Loading...
Multi-line text inputs are essential for longer content like descriptions, comments, or messages. TextareaField
wraps a textarea element with InputGroup to enable an optional tooltip button positioned at the bottom-right corner—useful for character limits or formatting guidelines without cluttering the label area.
The component accepts native textarea props like rows
and maxLength
directly. Common patterns include pairing maxLength
with Zod validation for minimum length requirements or using the description
prop to display character count guidance.
Built-in features
- Bottom-right tooltip positioned via InputGroup
align='block-end'
- Native textarea props support (rows, maxLength, placeholder)
- Zod validation: Native integration with react-hook-form and Zod schemas
- Multi-line error display for longer validation messages
Usage patterns
const schema = z.object({bio: z.string().min(10, 'Bio must be at least 10 characters'),feedback: z.string().max(500, 'Maximum 500 characters'),})const form = useForm({defaultValues: { bio: '', feedback: '' },resolver: zodResolver(schema),})// Basic textarea<TextareaFieldregister={form.register('bio')}label='Bio'description='Tell us about yourself'rows={4}/>// With character limit<TextareaFieldregister={form.register('feedback')}label='Feedback'description='Share your thoughts (max 500 characters)'rows={6}maxLength={500}placeholder='Your feedback...'/>// With tooltip<TextareaFieldregister={form.register('notes')}label='Notes'tooltip='Supports plain text only. Markdown coming soon.'rows={8}/>
Examples
Character Count
Loading...
Default
Loading...
Tooltip
Loading...
Props
Name | Type | Description |
---|---|---|
register | UseFormRegisterReturn | React Hook Form register function result |
label | string? | Field label text |
description | string? | Helper text displayed below the textarea |
tooltip | React.ReactNode? | Tooltip content displayed in an info icon button at bottom-right |
props | React.ComponentProps<typeof InputGroupTextarea>? | Native HTML textarea props (rows, maxLength, placeholder, etc.) |