text-area Component
Text Area System
Basic Text Areas - Flexible Input Structure
Preview
Code
Please provide at least 50 characters
Text Area Sizes - Consistent Scaling
Preview
Code
State Variants - Visual Feedback
Preview
Code
This field is required
Looks good!
Please review your input
This field is disabled
Character Counter - Track Input Length
Preview
Code
Basic Counter:
72/200
CHARACTERS
Near Limit (Warning State):
252/280
CHARACTERS
At Limit (Error State):
50/50
MAX
You've reached the character limit
Auto-resize - Dynamic Height Adjustment
Preview
Code
Grows as you type:
This textarea will expand as you type (max height: 300px)
With character counter:
0/500
CHARACTERS
Advanced Features - Complete Form Fields
Preview
Code
Full-featured form field:
0/1000
CHARACTERS
Minimum 100 characters required. Be as specific as possible.
Read-only display:
Fixed size (no resize handle):
Resize handle is disabled
Container Inheritance - Bulk Sizing
Preview
Code
Apply size to container for all children:
Individual override:
Color Variants - Themed Inputs
Preview
Code
Validation - Real-time Feedback
Preview
Code
Required field validation:
Leave blank and blur to see validation
With minimum length:
0/500
MIN 50
JavaScript API - Programmatic Control
Preview
Code
Interactive Demo:
0/200
CHARACTERS
Click buttons below to test API methods
Available Methods:
// Initialize all text areas TextArea.init(); // Update character counter TextArea.updateCounter(textarea); // Trigger resize for auto-resize TextArea.resize(textarea); // Set value and update UI TextArea.setValue(textarea, "New value"); // Set error state with message TextArea.setError(textarea, "This field is required"); // Clear error state TextArea.clearError(textarea); // Set success state with message TextArea.setSuccess(textarea, "Valid input!"); // Clear all states TextArea.clearState(textarea); // Initialize specific features TextArea.initCharacterCounters(); TextArea.initAutoResize(); TextArea.initValidation();
Usage Guidelines
When to Use Text Areas
Preview
Code
- Multi-line Input: When users need to enter more than one line of text
- Long-form Content: For comments, descriptions, feedback, or messages
- Structured Text: When users might use line breaks for formatting
- Character Limits: When you need to enforce and display text length constraints
- Variable Content: When content length varies significantly between users
Best Practices
Preview
Code
- Sizing: Set appropriate initial rows based on expected content
- Auto-resize: Enable for better UX when content length varies
- Character Counters: Always show for fields with limits
- Placeholders: Provide helpful examples or format hints
- Labels: Always include clear, descriptive labels
- Validation: Provide immediate feedback for errors
- Hints: Add helper text for complex requirements
Accessibility Considerations
Preview
Code
- Labels: Always associate labels with textareas using proper HTML structure
- Required Fields: Mark clearly with both visual and semantic indicators
- Error Messages: Ensure they're programmatically associated with the field
- Keyboard Support: All features must be keyboard accessible
- Screen Readers: Use aria-describedby for hints and error messages
- Color Contrast: Ensure sufficient contrast in all states
- Focus Indicators: Maintain clear, visible focus states