Textarea
Native controls work. Demo links and submissions stay inside this specimen. This example scrolls horizontally at this width.
Source markup
<!-- @dsCard group="Inputs" height=900 -->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Textarea</title>
<style>
/* Preview layout only; the host supplies tokens.css and bundle.css. */
.demo { display: grid; gap: var(--space-md); padding: var(--space-sm); }
.demo__states {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(100%, calc(var(--space-3xl) * 3)), 1fr));
gap: var(--space-md);
align-items: start;
}
.demo__state { display: grid; gap: var(--space-2xs); min-width: 0; }
/* Static copy of .input:focus-visible. Native keyboard focus also works. */
.input.is-focus {
outline: var(--focus-width) solid transparent;
outline-offset: var(--focus-offset);
border-color: var(--color-semantic-border-strong);
box-shadow: var(--shadow-focus-ring);
}
</style>
</head>
<body>
<main class="demo">
<h1 class="t-h3">Textarea</h1>
<p class="field__help">Static state examples. Editing and resizing work; validation and submission are not connected.</p>
<div class="demo__states">
<div class="demo__state">
<p class="t-label">Rest</p>
<div class="field">
<label class="field__label" for="nz-details">Details (optional)</label>
<textarea class="input input--textarea" id="nz-details" name="details" rows="4" maxlength="1000" placeholder="What happened, and what did you expect?" aria-describedby="nz-details-help"></textarea>
<p class="field__help" id="nz-details-help">Up to 1,000 characters. Include the steps needed to reproduce the issue.</p>
</div>
</div>
<div class="demo__state">
<p class="t-label">Valid example</p>
<div class="field">
<label class="field__label" for="nz-details-valid">Details</label>
<textarea class="input input--textarea input--valid" id="nz-details-valid" name="details-valid" rows="4" maxlength="1000" aria-describedby="nz-details-valid-help">The export stops after I choose a date range. I expected a file containing the selected records.</textarea>
<p class="field__success" id="nz-details-valid-help">Valid example: details entered within the 1,000-character limit.</p>
</div>
</div>
<div class="demo__state">
<p class="t-label">Error</p>
<div class="field">
<label class="field__label" for="nz-details-bad">Details (required)</label>
<textarea class="input input--textarea input--error" id="nz-details-bad" name="details-bad" rows="4" required maxlength="1000" aria-invalid="true" aria-describedby="nz-details-bad-help nz-details-bad-error"></textarea>
<p class="field__help" id="nz-details-bad-help">Up to 1,000 characters.</p>
<p class="field__error" id="nz-details-bad-error">Describe what happened before continuing.</p>
</div>
</div>
<div class="demo__state">
<p class="t-label">Focus visible</p>
<div class="field">
<label class="field__label" for="nz-details-focus">Details</label>
<textarea class="input input--textarea is-focus" id="nz-details-focus" name="details-focus" rows="4" aria-describedby="nz-details-focus-help">First, choose a date range.
Then select Export.</textarea>
<p class="field__help" id="nz-details-focus-help">Enter adds a new line. Tab moves to the next control.</p>
</div>
</div>
<div class="demo__state">
<p class="t-label">Disabled</p>
<div class="field">
<label class="field__label" for="nz-details-disabled">Details</label>
<textarea class="input input--textarea" id="nz-details-disabled" name="details-disabled" rows="4" disabled aria-describedby="nz-details-disabled-help">Select a record before adding details.</textarea>
<p class="field__help" id="nz-details-disabled-help">Unavailable until a record is selected.</p>
</div>
</div>
<div class="demo__state">
<p class="t-label">Read-only</p>
<div class="field">
<label class="field__label" for="nz-details-readonly">Recorded details</label>
<textarea class="input input--textarea" id="nz-details-readonly" name="details-readonly" rows="4" readonly aria-describedby="nz-details-readonly-help">The export stopped after a date range was selected.
Expected result: a file containing the selected records.</textarea>
<p class="field__help" id="nz-details-readonly-help">Read-only. You can select, copy and resize the text area.</p>
</div>
</div>
</div>
</main>
</body>
</html>
A native multiline text field for messages, descriptions and notes. Use Input for a single line and Select for a fixed list of choices.
Structure
Section titled “Structure”Use <textarea class="input input--textarea"> inside .field. Bind a persistent visible .field__label with matching for and unique id, then connect help through aria-describedby. Supply name, an appropriate rows count and any real constraints such as maxlength. Put the initial value between the tags, not in a value attribute. Show limits in help text; this component has no live character counter.
The additive class retains Input’s token colours, type, padding and radius-sm. Its minimum height derives from space-xl. Native rows can make it taller. Vertical resizing keeps long text inspectable without widening the surrounding layout; disabled fields cannot resize. There is no automatic height adjustment.
States
Section titled “States”- Rest and focus use the shared
.inputrules andshadow-focus-ring. - For a checked value,
.input--validand.field__successusecolor-semantic-status-successwith written feedback. - For an error, set
aria-invalid="true"and associate.field__errorthrougharia-describedby, keeping existing help IDs..input--errorremains an optional compatible class. Thecolor-semantic-status-errorborder remains during focus. Keep any entered text. - Native
disabledprevents editing, skips keyboard focus and excludes the value from form data. Explain the unavailable state beside the field. - Native
readonlyprevents editing while preserving focus, text selection, copying, resizing and inclusion in form data. Explain that state in help text.
Behaviour and accessibility
Section titled “Behaviour and accessibility”Keep the native multiline textbox role and keyboard behaviour. Enter inserts a line break; Tab moves to the next control. Do not intercept Tab to insert indentation in an ordinary message field. Mark required fields visibly and with required. The consumer must manage announcements or focus when validation adds an error.
The preview is static HTML/CSS. It does not validate or submit, and its example feedback does not change while typing. Native editing, length limits and resizing still work. Consumers provide validation, state updates, submission and any character-count behaviour.