Skip to content

Textarea

Multi-line text input with auto-resize and character count.

Basic Usage

tsx
import { Textarea } from '@airo-ui/react'
import { useState } from 'react'

function Demo() {
  const [value, setValue] = useState('')

  return (
    <Textarea
      value={value}
      onChange={(e) => setValue(e.target.value)}
      label="Message"
      placeholder="Say something..."
      rows={3}
    />
  )
}

Auto-resize + Character Count

With autosize, the textarea grows automatically. Use minRows / maxRows to set limits.

tsx
<Textarea
  value={value}
  onChange={(e) => setValue(e.target.value)}
  label="Auto-resize"
  autosize={{ minRows: 2, maxRows: 6 }}
  maxlength={200}
  showCount
/>

API

Props

NameTypeDefaultDescription
valuestring--Controlled value
defaultValuestring''Default value (uncontrolled)
placeholderstring--Placeholder text
disabledbooleanfalseDisabled
readonlybooleanfalseRead-only
errorbooleanfalseError state
errorMessagestring--Error message text
labelstring--Top label
rowsnumber3Initial rows
maxlengthnumber--Max characters
showCountbooleanfalseShow character count
autosizeboolean | { minRows?: number; maxRows?: number }falseAuto-resize options
onChange(e: ChangeEvent<HTMLTextAreaElement>) => void--Value change handler
onFocus(e: FocusEvent<HTMLTextAreaElement>) => void--Focus handler
onBlur(e: FocusEvent<HTMLTextAreaElement>) => void--Blur handler

MIT License