PolyHunter

TextArea

Multi-line text field on a filled container surface, fixed at 120px height (spacing-30) in small/medium/large sizes, with the same focus, hover, disabled, readonly and error states as TextInput. All colors come from tokens in @npolyhunter/ds/theme.css.

Playground

Live preview

Examples

Sizes

<TextArea size="small" placeholder="Small" />
<TextArea size="medium" placeholder="Medium" />
<TextArea size="large" placeholder="Large" />

With labels

Pair with the Label atom via htmlFor.

import { Label, TextArea } from "@npolyhunter/ui";

<div className="space-y-2">
  <Label htmlFor="bio">Bio</Label>
  <TextArea id="bio" placeholder="Tell us about yourself..." />
</div>

States

Focus switches to a 2px focus-neutral border. Invalid uses status-danger-border for the border and ring. Disabled keeps the container surface with a subtle border and disabled text. Readonly suppresses the focus treatment.

<TextArea placeholder="Default" />
<TextArea placeholder="Focus me" autoFocus />
<TextArea placeholder="With value" defaultValue="Line one
Line two" />
<TextArea placeholder="Disabled" disabled />

// Readonly — filled text stays foreground-default, empty shows the placeholder token,
// and the focus border treatment is suppressed
<TextArea readOnly defaultValue="Readonly value" />
<TextArea readOnly placeholder="Readonly placeholder" />

// Error — border uses status-danger-border; on focus it becomes 2px status-danger-foreground
// plus a danger-tinted ring
<TextArea invalid placeholder="Error" />
<TextArea invalid defaultValue="bad value" aria-describedby="error-id" />

Disabled

<TextArea disabled placeholder="Disabled" />
<TextArea disabled defaultValue="Disabled with value" />

Code

import { TextArea } from "@npolyhunter/ui";

// Default (120px height, filled container surface)
<TextArea placeholder="Type your message..." />

// Sizes small / medium / large
<TextArea size="small" placeholder="Small" />
<TextArea size="medium" placeholder="Medium" />
<TextArea size="large" placeholder="Large" />

// Error state
<TextArea invalid placeholder="Invalid input" />

// Disabled
<TextArea disabled placeholder="Disabled textarea" />

Code

const [value, setValue] = useState("");

<TextArea
  size="${size}"         // "small" | "medium" | "large"
  placeholder="${placeholder}"
  value={value}
  onChange={(e) => setValue(e.target.value)}
  invalid={invalid}
  disabled={disabled}
/>

Used in

Includes use through shared UI components.

AppBack Office