# Text area

**Text areas** allow users to enter multiple lines of text within a field.

## Usage

Use a text area when the expected user input spans multiple lines. For single-line input, use a [single-line field](<https://element.siemens.io/components/forms-inputs/input/>) instead.

![Text area](<../images/text-area.png>)

### Best practices

- Keep labels short and clear
- Use placeholders to reinforce the information needed in the input. They should not contain critical information, instead use labels for that.
- Assist while the user is entering the data ([warning, validation, etc.](<https://element.siemens.io/components/forms-inputs/text-area/#validation-states>))

## Design

### Elements

![Text area elements](<../images/text-area-elements.png>)

> 1\. Label (optional), 2. Content/Placeholder text, 3. Container, 4. Icon (optional), 5. Helper text (optional), 6. Resizer (optional)

### Interaction states

![Text area states](<../images/text-area-states.png>)

### Validation states

Real time validation helps to streamline the process and keep input data clean while the user is filling out the field.

![Text area validation](<../images/text-area-validation.png>)

### Content overflow

The input height can be fixed, with overflow managed by a scrollbar, or it can grow dynamically as the user types. Users may also manually resize the field if resizing is enabled.

## Code

### References

- **Bootstrap:** [Form Control](<https://getbootstrap.com/docs/5.1/forms/form-control/>)

### Example

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component } from '@angular/core';

@Component({
  selector: 'app-sample',
  templateUrl: './multi-line.html',
  host: { class: 'p-5' }
})
export class SampleComponent {}
```

Template:

```html
<h4>Multi-Line</h4>
<form class="px-4">
  <div class="mb-6">
    <label for="exampleInput" class="form-label">Name</label>
    <textarea class="form-control" id="exampleInput" placeholder="Placeholder"></textarea>
    <small class="form-text">Helper text</small>
  </div>

  <div class="mb-4">
    <label for="exampleDisabledPlaceholder" class="form-label">
      Disabled textarea (empty with placeholder)
    </label>
    <textarea
      disabled
      class="form-control"
      id="exampleDisabledPlaceholder"
      placeholder="Placeholder not visible"
    >
    </textarea>
    <small class="form-text">Placeholder text not displayed for disabled textarea</small>
  </div>
  <div class="mb-4">
    <label for="exampleInput1" class="form-label">Disabled textarea with value</label>
    <textarea disabled class="form-control" id="exampleInput1">This is the value</textarea>
  </div>

  <div class="mb-4">
    <label for="exampleInput2" class="form-label">Readonly textarea</label>
    <textarea readonly class="form-control" id="exampleInput2">This is the value</textarea>
  </div>

  <div class="mb-4">
    <label for="exampleInput3" class="form-label">Name</label>
    <textarea class="form-control is-valid" id="exampleInput3">This is valid</textarea>
  </div>

  <div class="mb-4">
    <label for="exampleInput4" class="form-label">Name</label>
    <textarea class="form-control is-warning" id="exampleInput4">This is ok-ish</textarea>
    <div class="warning-feedback">Feedback text</div>
  </div>

  <div class="mb-4">
    <label for="exampleInput5" class="form-label">Name</label>
    <textarea class="form-control is-invalid" id="exampleInput5">Just no</textarea>
    <div class="invalid-feedback">Feedback text</div>
  </div>
</form>
```
