Textarea
A multi-line text field. It shares the label, hint, error, and variants with Input, and adds auto-growing height.
Forms · TaishoDS Core, in plain HTML.
Examples
One working example per case. Each example is the HTML of its preview—copy it as is, and with Core’s CSS and JS loaded, it looks and works the same.
Comment with placeholder
Clearable
Loading
Resizable on both axes
Comment that waits until you stop typing
Class reference
Every value of each modifier, with its HTML ready to copy.
Size
Base height of the area: sm, md, or lg.
Variant
The border color for validation: success, warning, info, or danger.
Density
The field’s inner spacing.
States
is-disabled blocks editing; is-readonly prevents it but keeps the field focusable and selectable; is-loading adds the Spinner without blocking editing.
Resize
The corner handle. resize-none removes it; resize-horizontal and resize-both enable it on that axis; vertical (no class) is the default.
Combinations
Size, variant, and density combined.
When to use
- The expected text spans several lines, like a comment, description, or note.
- You want the field to grow with its content (auto-resize).
- The user needs to see everything they’ve written at once.
When not to use
- The text is short and fits on one line →
input. - It’s a value from a closed set →
select.
Do
- Give it a starting number of rows that matches what you expect.
- Build it with the
fieldmarkup and, if there’s a limit, show the counter.
Don’t
- Don’t use it for a single line just because it looks bigger.
- Don’t hide the character limit if there is one.
TaishoDS Core
Needs Core’s JS, which hooks in through data-ts-* attributes.
It’s a native <textarea>, plus its own clear button.
Core hooks into it through these attributes. They go in the markup, and there’s nothing to initialize.
data-ts-cleardata-ts-debouncedata-ts-field-spinnerdata-ts-textarea
What it does: The caret starts at the end of the initial value, as in Input. To make the height grow as you type, listen to input and copy scrollHeight to the height. Without it, the textarea still works, at a fixed height.
| Attribute | What it does |
|---|---|
data-ts-clear | The clear button, as in Input. |
data-ts-field-spinner | The loading Spinner. setTextareaLoading(root, true | false) marks the field as busy and shows it. It doesn’t block editing. |
data-ts-debounce="ms" | On the <textarea>. Core fires ts:debouncedinput (with detail.value) once typing stops. |
resize-none, resize-horizontal, resize-both | A class on the container sets the resize. |
From the CDN, without a build, load taisho.textarea.css along with taisho.base.css. Also load:
taisho.button.csstaisho.icon.csstaisho.spinner.css
For how Core works in general, see Behavior.
Accessibility
- The
labelis associated throughfor/id. Theidis written in the HTML and must be unique on the page. - The hint text (
ts input-hint) and the error message are linked to the<textarea>througharia-describedby. An invalid field carriesaria-invalid="true". readonlyaddsis-readonlyto the wrapper (transparent background,defaultcursor). The field stays focusable and selectable, distinguishable from an editable field and from adisabledone.- The clear button (
data-ts-clear) has its ownaria-label, shows up only when there’s text, and not in readonly or disabled. After clearing, focus returns to the<textarea>. It sits at the top right, in reserved space, without covering the text or the resize handle. - For the loading state, call
setTextareaLoading(root, true|false). It setsis-loadingandaria-busy="true"on the<textarea>, and shows the Spinner (role="status") at the top right, next to the clear button. If you set only the class, it changes the look but isn’t announced. It doesn’t disable or block editing, so you can keep typing while it validates. - With
data-ts-debounce, thets:debouncedinputevent waits until typing stops (300 ms by default), soaria-busydoesn’t fire on every keystroke. Theinputevent stays immediate, and clearing reports the empty value right away. resize-none,resize-horizontal, andresize-bothonly change the corner handle. They don’t change the role or the name. Withauto-resize, the vertical axis turns off, because the content drives the height.
Verification
What was actually tested. Anything that wasn’t tested says so—we’d rather say “not verified” than claim too much.
- axe WCAG 2.2 A + AA in a real browser, in light and dark mode, before every release.
- keyboard Adds no keys of its own—it uses the browser’s native behavior.
- screen reader Not verified with a screen reader. Test it in your own combination of components, not just here, where each one appears alone and on its happy path.