Skip to main content
Tw Twintrinsic
  • Getting Started
  • Components
  • Theming
  • Completion
Examples
Data Dashboard Game Map
Core
App
Layout
Accordion AccordionItem Card Container Panel Separator Sidebar Splitter
Navigation
AppHeader BottomBar Breadcrumb BreadcrumbItem Menu MenuItem Tabs Tab TabList TabPanel TreeMenu
Data Display
Avatar AvatarGroup Badge Carousel CarouselItem Chip ChipGroup CodeBlock CodeBlockSpeed CodeEditor DataTable Map Progress Skeleton Table TableBody TableCell TableHead TableHeader TableRow Tag TagGroup Timeline TimelineItem Tooltip Tree TreeNode
Metrics
DonutChart PieChart LineChart BarChart HorizontalBarChart AreaChart StatsCard MetricGrid KPICard GaugeChart ProgressMetric MetricTrend
Form
AutoComplete Button ButtonGroup Calendar Checkbox ColorPicker Combobox Dropdown FileUpload FloatLabel Form FormField Input InputSwitch InvalidState Knob ListInput Listbox NumberInput Radio RadioGroup Rating Select SelectGroup Slider Switch TextInput Textarea
Feedback
Modal Stepper StepperStep Toast
Utility
Icon Lazy LazyPanel Masonry ThemeToggle

Textarea

The Textarea component provides a styled multi-line text input with support for auto-resizing, form integration, and accessibility features. It's designed for collecting longer text content like descriptions, messages, or comments.

Examples

Basic Usage

<Textarea 
  placeholder="Enter your message here"
  rows={3}
/>

With Initial Value

<Textarea 
  value="This is a pre-filled textarea with some initial content."
  rows={3}
/>

Auto-resize

<Textarea 
  placeholder="This textarea will grow as you type..."
  autoResize={true}
  rows={2}
/>

Disabled State

<Textarea 
  value="This textarea is disabled and cannot be edited."
  disabled={true}
  rows={3}
/>

Read-only State

<Textarea 
  value="This textarea is read-only but can still be focused and copied."
  readonly={true}
  rows={3}
/>

With Character Limit

<Textarea 
  placeholder="Maximum 100 characters allowed"
  maxlength="100"
  rows={3}
/>

Required Field

<Textarea 
  placeholder="This field is required"
  required={true}
  rows={3}
/>

Props

PropTypeDefaultDescription
valuestring''Textarea value
placeholderstring''Placeholder text
rowsnumber3Number of visible text rows
namestringRequiredName attribute for the textarea
requiredbooleanfalseWhether the textarea is required
disabledbooleanfalseWhether the textarea is disabled
readonlybooleanfalseWhether the textarea is read-only
autoResizebooleanfalseWhether to automatically resize based on content
minlengthstringRequiredMinimum length of text
maxlengthstringRequiredMaximum length of text
autocompletestringRequiredHTML autocomplete attribute
ariaLabelstringRequiredARIA label for accessibility
idstringauto-generatedHTML id for accessibility
classstring''Additional CSS classes

Events

EventDetail TypeDescription
oninput{ value: string }Fired on each keystroke or input
onchange{ value: string }Fired when the value changes
onfocusEventFired when the textarea gains focus
onblurEventFired when the textarea loses focus

Accessibility

The Textarea component follows accessibility best practices:

  • Native <textarea> element for best compatibility
  • Proper focus states with visible indicators
  • Support for ARIA labels
  • Proper disabled and readonly states
  • Compatible with screen readers
  • Integrates with form validation

Form Integration

The Textarea component integrates with the Form component for validation and submission:

<Form onSubmit={handleSubmit}>
  <FormField label="Message" error={errors.message}>
    <Textarea 
      name="message"
      required={true}
      placeholder="Enter your message"
    />
  </FormField>
  <Button type="submit">Send</Button>
</Form>