Text Area
Multi-line text for longer answers such as notes, descriptions and messages, with Input Field's label, helper text and states, a character counter and a resize handle.
Ritla scan of this preview: 41 of 41 checks3 breakpointsScanned
Preview
Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.
Installation
Add the component
npx ritla add textareaAlso works with shadcn:
npx shadcn@latest add @ritla/textareaDependencies it brings
@base-ui/react@phosphor-icons/reactOr copy by hand
Installing by hand copies the component's source into your project. The source comes with a Ritla UI license, so the CLI is the short way to the same files.
Usage
import { Textarea } from "@/components/ui/textarea";<Textarea label="Note to recipient" limit={200} helperText="The recipient sees this note." />Examples
States
The same states and colors as Input Field. Size the box to the expected answer: 3 to 6 lines (rows).
Character counter
limit shows “37/100” in the page numerals. Going over is allowed: the counter turns red and the field says why, so text is never cut silently. Screen readers hear “10 characters left” near the limit only.
Resizing
resize: vertical (Figma's handle, the default), auto (grows with the text up to maxRows) or none.
API reference
Textarea
Also takes every <textarea> prop.
| Prop | Type | Default | Description |
|---|---|---|---|
label | ReactNode | None | Figma's Label. |
limit | number | None | Figma's Counter: the counter and the limit, without cutting text. |
limitMessage | string | None | Your own message past the limit. Default: in the page language. |
resize | "vertical" | "auto" | "none" | "vertical" | Figma's handle, grow with the text, or fixed. |
rows | number | 4 | Visible lines. |
maxRows | number | None | With resize="auto": the most lines before it scrolls. |
required / helperText / error / disabled / readOnly | … | None | As on Input Field. |
Usage guidelines
A text area is for answers of several sentences that people see as they write. When to pick it over an input field, how tall to make it, how to handle a character limit, and the checks before handoff.
1. Text area or input field
Match the box to the answer. If people answer in a few words, use Input field; a tall box makes a short answer feel wrong. Use a text area when the answer is sentences, and people need to see what they wrote as they write it.
| The answer is | Use | Why |
|---|---|---|
| A name, a city, a title, a short code | Input field | One line; Enter can submit the form. |
| Notes, a description, a review, a message | Text area | Several lines, visible while typing; Enter adds a line. |
| One option from a known list | Select | No typing, no spelling mistakes. |
The box sets expectations
Two fields in a delivery form.
2. Height and resizing
Show 3 to 6 lines, sized to the answer you expect: a short note needs 3, a product description 6. Let people make it taller. In code, resize="vertical" (the default) keeps Figma's handle, resize="auto" grows the box with the text up to maxRows, and resize="none" fixes the height.
Do
- Size the box to the answer you expect, between 3 and 6 lines.
- Let the box grow or be resized vertically.
- Keep the same width as the other fields in the form.
Don't
- Show a one-line text area; that is an Input field.
- Allow horizontal resizing; it breaks the form layout.
- Make the box taller than the screen on mobile.
3. Character limits
Show the counter only when there is a real limit. People can keep typing past it: the counter and the field turn to Error and the message says what to do, so nothing is cut without warning. Screen readers hear the count only near the limit. The counter follows the numerals setting.
Say what to do past the limit
A short product description.
Do
- Say the limit in the helper text before people start.
- Let people type past the limit, then show the Error state with a message.
- Use your own limit message when the default doesn't fit.
Don't
- Cut text silently at the limit.
- Show a counter when there is no limit.
- Show the error with only a red counter and no message.
4. Arabic, English and both
People write notes in whichever language they think in, often both. In code the text takes dir="auto", so each paragraph runs in its own direction. On Arabic screens use the RTL variant: the label and helper align right, and the counter and resize handle move to the bottom left, the inline end.
Arabic form, mixed text
A delivery note in an Arabic checkout.
Before handoff
- A text area only where answers take sentences.
- Height between 3 and 6 lines, and the resize mode noted.
- A limit, if any, is in the helper text, with an error message.
- Arabic screens use the RTL variant.
Accessibility
Keyboard
Keys are written for left-to-right. In right-to-left the arrow keys swap: the one pointing toward the reading direction moves forward.
| Key | Action |
|---|---|
| Tab | Moves focus to the field; Enter adds a line. |
ARIA
- A real
<textarea>with a label; the helper text and the counter are linked witharia-describedby. - Near the limit (20, 10, 5 and 0 left) and past it, the count is announced politely, not on every key.
- Going over sets
aria-invalidand shows why. - The resize handle is for pointer and touch and hidden from screen readers;
resize="auto"needs no dragging.
Do
- A visible label; it is the accessible name.
- Enter adds a new line; people submit with the form's button.
- Keep the counter readable, in the helper text's color.
Don't
- Submit on Enter inside a text area.
- Put the only instructions in the placeholder.
Arabic and RTL notes
Mirrors
- The counter and the handle sit at the inline end (bottom left), and the handle mirrors to point at the corner.
Does not mirror
- The counter “37/100” is isolated left to right.
- Numerals
- The counter follows
numerals: ٣٧/١٠٠ or 37/100. - Arabic typography
- Text is
body-16, with taller Arabic line heights, so each line fits the diacritics. - Mixed-direction text
- The field takes
dir="auto": an English note in an Arabic form runs left to right and keeps its punctuation at the end.
Do
- The RTL variant on every Arabic screen.
- Keep
dir="auto"; don't force RTL or LTR on the text. - Brand and product names in their own script inside Arabic text.
Don't
- Arabic in the English variant.
- Mirror the resize grip by hand.
Checks it passes
The Ritla checks this component satisfies by construction. Used as documented, it does not bring these defects onto your page.
- Arabic text falling back past the declared font family (measured, declared, or a webfont that failed to load)
- letter-spacing applied to Arabic text (breaks the connected script)
- Text inputs rendered LTR where Arabic input is expected
- Clipped text: content wider than its box with overflow hidden and no ellipsis
- Fixed-pixel-width container whose Arabic text exceeds the space