Skip to content

Textarea

Multi-line text input for longer content — comments, descriptions, background stories. Supports character count with over-limit indication.


Preview

Beskriv din situation

Du har 200 tegn tilbage


When to use

Use for unstructured text of more than 2 lines. Set height to match expected input length.

Do not use for structured data where consistency matters.


Usage

html
<div class="input-field">
  <label class="input-label" for="comment">Kommentar</label>
  <p class="input-help">Beskriv din situation</p>
  <textarea id="comment" class="textarea" rows="4" placeholder="Skriv her..."></textarea>
</div>

With character count

html
<div class="input-field">
  <label class="input-label" for="desc">Beskrivelse</label>
  <textarea id="desc" class="textarea" rows="4"></textarea>
  <p class="textarea-count">Du har 60 tegn tilbage</p>
</div>

Classes

ClassDescription
.textareaBase textarea styling
.textarea--errorError border
.textarea--disabledDisabled state
.textarea--readonlyReadonly state
.textarea-countCharacter count text
.textarea-count--overOver-limit styling (red)
.input-fieldWrapper (reused from Input)
.input-labelLabel (reused)
.input-helpHelp text (reused)
.input-errorError text (reused)

Accessibility

  • <label> associated via for/id
  • aria-invalid when in error state
  • aria-describedby for help/error text
  • Character count uses aria-live="polite"
  • Do not stop input when over limit — show warning instead

References