usmds docs

TextArea

TextArea allows users to enter and edit multiline text content.

Installation

npx usmds add textarea

Usage

import { TextArea } from '@components/TextArea';
 
<TextArea 
  label="Text input label"
  placeholder="Enter your text here"
/>

Props

TextArea

Extends React Native's TextInput props.

PropTypeDefaultDescription
labelstring-Label text displayed above the textarea.
helperTextstring-Helper text displayed below the label.
errorbooleanfalseWhen true, displays error styling.
maxLengthnumber-Maximum number of characters allowed.
valuestring''The current value of the textarea.
disabledbooleanfalseWhen true, prevents user interaction.
classNamestring-Additional Tailwind classes to apply.

Examples

Default TextArea

<TextArea 
  label="Text input label"
  placeholder="Enter your text here"
/>

With Helper Text

<TextArea 
  label="Text input label"
  helperText="Helper text"
  placeholder="Enter your text here"
/>

With Error State

<TextArea 
  label="Text input label"
  helperText="Error message"
  error={true}
  placeholder="Enter your text here"
/>

Disabled State

<TextArea 
  label="Text input label"
  placeholder="This field is disabled"
  disabled={true}
/>

Styling

The TextArea component uses Tailwind CSS classes for styling. Default styling includes:

  • Container width: 329px
  • Minimum height: 160px
  • Base text size with 24px line height
  • Rounded corners (6px)
  • 2px border width
  • Consistent padding (8px 12px)
  • White background
  • Base ink text color
  • Gray placeholder color
  • Error state styling
  • Disabled state styling with lighter background

States

The textarea has several visual states:

  • Default: White background with base ink border
  • Focused: Primary color border
  • Error: Error color border
  • Disabled: Light gray background with reduced opacity

Accessibility

The TextArea component:

  • Uses semantic text input structure
  • Provides clear labeling
  • Supports screen readers
  • Maintains proper text contrast
  • Includes helper text for additional context
  • Shows error states clearly
  • Supports keyboard navigation

On this page