runway

Runway

TextArea

A flexible multi-line text input with auto-grow, label, helper/error messages, and slot support.



The TextArea component is a multi-line text input field that can auto-grow, display a label above itself, show helper/error messages, and optionally include custom buttons or other elements within dedicated slots.

You can also add custom buttons or other elements in the top-left, top-right, bottom-left, and bottom-right corners of the textarea.



Usage

javascript

1import TextArea from "@/components/atoms/TextArea";
2import { useState } from "react";
3
4export default function Example() {
5    const [value, setValue] = useState("");
6
7    return (
8        <TextArea
9            id="feedback"
10            value={value}
11            onChange={(e) => setValue(e.target.value)}
12            placeholder="Write your thoughts here..."
13        />
14    );
15}



Props

PropTypeDefaultDescription
idstring-An identifier for the <textarea>.
labelstring""Label text displayed above the textarea (when showLabel is true).
helperTextstring""Shows a helper message below the text area if no error is set.
errorstring""When present, displays an error message in a red color (overrides helperText).
paddingnumber8Numeric padding for container (in px).
borderRadiusstring"md"Tailwind border-radius class (e.g. "none", "sm", "md", "lg", "full", etc.).
focusbooleantrueIf true, a focus ring/border is applied based on the activeColor.
activeColorstring"primary"Tailwind color key used for the focus ring and border (focus-within:border-*).
autoGrowbooleantrueAutomatically adjusts height to fit content, respecting minRows and maxRows.
minRowsnumber2Minimum number of rows the textarea can display.
maxRowsnumber8Maximum number of rows the textarea can grow to before scrolling appears.
topRightSlotReactNode-Custom content (e.g. buttons, icons) in the top-right corner of the textarea.
bottomRightSlotReactNode-Custom content (e.g. buttons, icons) in the bottom-right corner of the textarea.
bottomLeftSlotReactNode-Custom content (e.g. buttons, icons) in the bottom-left corner of the textarea.
valuestring-Controlled value of the textarea. If set, the component operates in controlled mode; otherwise it uses internal state.
onChangefunction-Callback fired on change, receiving the event.
classNamestring""Additional Tailwind classes for the container.
...propsobject-Any other valid <textarea> attributes (e.g. placeholder, disabled, etc.).

TextArea supports all standard HTML <textarea> attributes. You can pass them through via props (e.g. placeholder, required, disabled, etc.).




Examples

Basic Usage

If you don't want the focus ring, set focus={false}.


Slots for Extra Buttons or Info

0 words

You can use the topLeftSlot, topRightSlot, bottomLeftSlot, or bottomRightSlot to place custom buttons (like "Clear", "Undo", "Save Draft") or badges, icons, counters, etc.


Custom Sizing & Border Radius


Helper & Error Messages

Your feedback is important to us.

This field is required.


Auto-Grow with Row Limits

Tailor minRows and maxRows to manage how the textarea expands.