Components
Textarea

Textarea

The Textarea component provides you with multi-line text fields.

Import

import { Textarea } from '@nostromo/ui-core'
// or
import { Textarea } from '@nostromo/ui-core/textarea'

Usage

import { Textarea, Label } from '@nostromo/ui-core'
 
export default function Example() {
  const [value, setValue] = React.useState('')
  
  return (
    <div className="space-y-2">
      <Label htmlFor="message">Message</Label>
      <Textarea
        id="message"
        placeholder="Enter your message..."
        value={value}
        onChange={(e) => setValue(e.target.value)}
        rows={4}
      />
    </div>
  )
}

Live Examples

Live Example
☀️
Copy
Storybook →
View Code
import { Textarea } from '@nostromo/ui-core' export default function TextareaExample() { return ( <div className="space-y-4"> <Textarea placeholder="Type your message here..." /> <Textarea placeholder="Large textarea" rows={6} /> </div> ) }...

With Label

Live Example
☀️
Copy
Storybook →
View Code
import { Textarea, Label } from '@nostromo/ui-core' export default function TextareaWithLabel() { return ( <div className="space-y-2"> <Label htmlFor="message">Message</Label> <Textarea id="message" placeholder="Your message..." /> </div> ) }...

Props

PropTypeDefaultRequiredDescription
variant"default" | "error" | "success""default"NoVisual variant (auto-set based on error/success)
size"sm" | "default" | "lg""default"NoSize of the textarea
labelstringundefinedNoLabel text displayed above textarea
helperTextstringundefinedNoHelper text displayed below textarea
errorbooleanfalseNoWhether the textarea has an error state
requiredbooleanfalseNoWhether the textarea is required
autoResizebooleantrueNoWhether textarea automatically resizes
placeholderstringundefinedNoPlaceholder text
rowsnumber3NoNumber of visible rows
disabledbooleanfalseNoWhether the textarea is disabled
valuestringundefinedNoControlled textarea value
defaultValuestringundefinedNoDefault value (uncontrolled)
onChange(event: React.ChangeEvent<HTMLTextAreaElement>) => voidundefinedNoChange event handler
idstringundefinedNoTextarea ID (auto-generated if not provided)
namestringundefinedNoTextarea name for form submission
maxLengthnumberundefinedNoMaximum character length
minLengthnumberundefinedNoMinimum character length
readOnlybooleanfalseNoWhether the textarea is read-only
classNamestringundefinedNoAdditional CSS classes

Standard HTML Textarea Props

The Textarea component extends all standard HTML textarea attributes, including:

  • autoComplete, autoFocus, cols, form, wrap
  • aria-* attributes for accessibility
  • data-* attributes for custom data
  • All other standard HTML textarea attributes