Textarea
A multi-line text field that shares the Input label, helper and error pattern.
Use a textarea for longer text such as a comment, a bio or release notes. It is three lines tall by default and people can drag it taller.
Shown to everyone who installs the update.
import { Textarea } from "@aloxe/react";
export default function TextareaBasic() {
return (
<Textarea
label="Release notes"
name="notes"
placeholder="What changed in this version"
description="Shown to everyone who installs the update."
className="w-full max-w-md"
/>
);
}Installation
npm i @aloxe/react @aloxe/tokensThen add the CSS imports from Installation.
Usage
import { Textarea } from "@aloxe/react";
<Textarea label="Release notes" name="notes" />Native textarea props such as name, maxLength and ref go to the <textarea>. className styles the wrapper.
Examples
States
error sets the error state and links the message to the field. disabled dims it and turns off resizing.
import { Textarea } from "@aloxe/react";
export default function TextareaStates() {
return (
<div className="flex w-full max-w-md flex-col gap-6">
<Textarea
label="Bio"
rows={2}
error="Keep it under 160 characters."
defaultValue="Designer and engineer in Lisbon."
/>
<Textarea
label="Internal notes"
rows={2}
disabled
defaultValue="Only admins can edit this field."
/>
</div>
);
}Controlled
A controlled textarea can show what's left of a limit in the description. The error appears only once the text goes over.
160 characters left
"use client";
import { Textarea } from "@aloxe/react";
import { useState } from "react";
const LIMIT = 160;
export default function TextareaControlled() {
const [bio, setBio] = useState("");
const left = LIMIT - bio.length;
return (
<Textarea
label="Bio"
value={bio}
onChange={(event) => setBio(event.target.value)}
description={`${left} characters left`}
error={left < 0 ? `${-left} characters over the limit` : undefined}
className="w-full max-w-md"
/>
);
}Accessibility
| Key | Action |
|---|---|
| Tab | Moves focus to the textarea. |
| Enter | Adds a new line; it does not submit the form. |
- The label is the accessible name, and
descriptionanderrorare linked witharia-describedby. - If you show a character count, put it in
descriptionso it is read with the field.
API reference
Every part accepts className and renders a data-aloxe attribute you can target in CSS, such as [data-aloxe="textarea"].
Textarea
Extends Base UI Field; other props go to the native <textarea>.
| Prop | Type | Default | Description |
|---|---|---|---|
| label (required) | ReactNode | The visible label and the textarea's accessible name. | |
| showLabel | boolean | true | false hides the label visually only. Screen readers still announce it. |
| description | ReactNode | Helper text under the textarea, linked with aria-describedby. | |
| error | ReactNode | Error message. Sets the error state and links the message to the textarea. | |
| rows | number | 3 | Initial height in lines. Users can resize vertically. |
| disabled | boolean | false | Disables the textarea and turns off resizing. |
| className | string | Classes for the wrapper. Other props go to the <textarea>. |
Figma
Matches the Textarea component. Figma Label, Value and Helper map to label, value and description; Show label maps to showLabel. The Error state is the error prop.
See Figma for where to get the file and how its names map to code.