Skip to content

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

html

Clearable

html

Loading

html

Resizable on both axes

html

Comment that waits until you stop typing

html

Class reference

Every value of each modifier, with its HTML ready to copy.

Size

Base height of the area: sm, md, or lg.

html

Variant

The border color for validation: success, warning, info, or danger.

html

Density

The field’s inner spacing.

html

States

is-disabled blocks editing; is-readonly prevents it but keeps the field focusable and selectable; is-loading adds the Spinner without blocking editing.

html

Resize

The corner handle. resize-none removes it; resize-horizontal and resize-both enable it on that axis; vertical (no class) is the default.

html

Combinations

Size, variant, and density combined.

html

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 field markup 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.

Related

InputField

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-clear
  • data-ts-debounce
  • data-ts-field-spinner
  • data-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-clearThe clear button, as in Input.
data-ts-field-spinnerThe 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-bothA 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.css
  • taisho.icon.css
  • taisho.spinner.css

For how Core works in general, see Behavior.

Accessibility

  • The label is associated through for/id. The id is 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> through aria-describedby. An invalid field carries aria-invalid="true".
  • readonly adds is-readonly to the wrapper (transparent background, default cursor). The field stays focusable and selectable, distinguishable from an editable field and from a disabled one.
  • The clear button (data-ts-clear) has its own aria-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 sets is-loading and aria-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, the ts:debouncedinput event waits until typing stops (300 ms by default), so aria-busy doesn’t fire on every keystroke. The input event stays immediate, and clearing reports the empty value right away.
  • resize-none, resize-horizontal, and resize-both only change the corner handle. They don’t change the role or the name. With auto-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.