Skip to content

Textarea

The Textarea component is a multi-line text input with options for a label, caption, character counter, resizing behaviour, validation states, and an info tooltip.

label, placeholder, and caption cover the text around the field, while error and warning show a validation message and switch the theme (otherwise set theme directly). rows sets the starting height, resizable lets the user drag to resize, and autoResize grows the field to fit its content. maxCharacters shows a used / max counter, and orientation places the label above or beside the field. Try them in the playground below.

Variations

With tooltip

tooltipContent sets the content of the label’s info tooltip (available as a control in the playground above). Pass tooltipProps to customise the tooltip — for example, swapping its icon:

Mention textarea

MentionTextarea extends Textarea with an inline suggestion menu. Typing the triggerChar (default @) opens a list of items at the caret; selecting one inserts formatMention(item) (default @[value]). It is controlled through value / onValueChange and accepts all Textarea props.

import { MentionTextarea } from "@harnessio/ui/components";
<MentionTextarea
value={value}
onValueChange={setValue}
items={[{ id: "1", value: "alice", label: "Alice Smith" }]}
/>;

Installation

import { Textarea } from "@harnessio/ui/components";
<Textarea
label="Textarea label"
placeholder="Placeholder"
name="textarea-name"
onChange={handleChange}
/>;