Text area

Text areas allow users to enter and edit multi-line text. They typically appear in forms.

UsageCodeAccessibility
  <sl-text-area aria-label="Hobbies" value="Painting, drawing, dance..."></sl-text-area>

When to use

The following guidance describes when to use the text area component.

Unconstrained input

When you need to collect input that can be of variable length, such as comments, descriptions, or notes. Use a text area when the newline character (line break) is a valid part of the content.

When not to use

The following guidance describes when not to use the text area component.

Single-line input

If the input is expected to be short and concise, consider using a text field component instead of a Text Area. For instance, when collecting a username or password a single-line input is more appropriate.

Anatomy

ItemNameDescriptionOptional
1Input containerAn interactive input area.No
2Input & placeholder textInput text is a value the user has entered into an input and the placeholder text is a short hint that describes the expected value of an input.No
3CaretA thin vertical line that blinks to indicate where input will be inserted.No
4Resize handleAn indicator that appears in the bottom right corner of the input container.No

Figma Options

With these options, you can tweak the appearance of the text area in Figma. They are available in the Design Panel so you can compose the text area to exactly fit the user experience need for the use case you are working on.

Text Area

ItemOptionsDescription
Sizemd lgThe text area come in two sized medium (default) and large.
Statedefault valid invalidTo indicate the state of the text area.
FilledbooleanTo indicate if the text area is filled or displays a placeholder.
Input textvalueTo insert the text of the filled text or placeholder.

Label

ItemOptionsDescription
LabelbooleanTo display a label.
Sizesm md lgThe label come in three sizes small, medium (default) and large.
DisabledbooleanTo show the disabled state of the label.
RequiredbooleanIndicates if the text area is required.
OptionalbooleanIndicates if the text area is optional.
InfobooleanTo show a info icon with tooltip after the label.
TextvalueTo insert the text of the label.

Hint

ItemOptionsDescription
HintbooleanTo display the hint.
Sizesm md lgThe label come in three sizes small, medium (default) and large.
Statedefault disabled invalidTo indicate the state of the hint.
IconbooleanDisplays an icon in front of the hint.
TextvalueTo insert the text of the hint.

Focus ring

ItemOptionsDescription
Focus ringbooleanTo display the focus state of the text area.
Interactive example