Mushilu-San UI

Search components

PlaygroundStorybookGitHub
Forms

Textarea

A multi-line text field for longer free-form input.

Selector: textarea[muiTextarea]

Import
import { Textarea } from '@mushilu-san/ui/forms';
PreviewCode

Loading example…

Overview

Textarea is applied to a native <textarea>. Set resize to control whether the user can resize it: vertical by default, none to fix the size, or both.

As with Input, invalid also sets aria-invalid="true". Link the error message with aria-describedby.

When to use

  • A comment, description or message that can span several lines.
  • Any free-form text where the length is not known in advance.

When not to use

  • A single line, such as a name or email. Use an input. Use Input instead.

Examples

Sizes and resize

PreviewCode

Loading example…

Guidelines

Do

  • Show a character count when there is a limit.
  • Keep the default vertical resize so long text can grow.

Don't

  • Do not disable resizing on a field where users write long text.

Accessibility

Roles and attributes

ElementRoleNotes
textarea[muiTextarea]textbox (native)invalid sets data-invalid and aria-invalid="true".

Keyboard

KeysAction
TabShiftTabMoves focus to and from the textarea.
EnterInserts a new line.
  • Name the textarea with a <label> or aria-label.

API

Textarea

Selector: textarea[muiTextarea]

NameTypeDefaultDescription
size'sm' | 'md' | 'lg''md' Textarea text size and padding: `sm`, `md` or `lg`. Default `md`.
variant'ghost' | 'outline' | 'filled''outline' Visual style: `outline`, `filled` or `ghost`. Default `outline`.
resize'vertical' | 'none' | 'both''vertical' Whether the user can resize the textarea: `none`, `vertical` or `both`. Default `vertical`.
invalidbooleanfalse Shows the failed-validation style and sets `data-invalid`. Also sets `aria-invalid`. Accepts attribute presence, e.g. <… invalid>.

CSS parts

  • ::part(textarea)

Tokens

  • --mui-color-surface
  • --mui-color-border
  • --mui-color-text
  • --mui-color-focus-ring
  • --mui-radius-md