Components
TextArea
A form component for multi-line text input. Provides a consistent interface for longer text content with support for validation and accessibility features.
Props
label
: string (optional) - Label text for the textarea- All standard HTML textarea attributes are supported
Usage Examples
Basic TextArea
With Form Integration
With Character Count
With Validation
Auto-resize
Styling
The component uses Tailwind CSS for styling and includes:
- Consistent padding
- Focus states
- Error states
- Rounded corners
- Dark mode support
- Disabled styling
- Responsive height
Best Practices
-
Input Guidelines:
- Provide clear labels
- Set appropriate size
- Consider character limits
- Use placeholder text wisely
-
Validation:
- Show clear error states
- Validate on submit
- Consider real-time validation
- Provide helpful messages
-
User Experience:
- Consider auto-resize
- Maintain consistent width
- Show remaining characters
- Handle long content
Accessibility
- Proper label association
- Error announcements
- Keyboard navigation
- Focus management
- ARIA attributes
- Color contrast
Implementation Notes
- Uses React’s forwardRef
- Integrates with forms
- Supports validation
- Handles resizing
- Maintains state
- Error handling