Components · Forms

Textarea

Free clinical text — the one field where a clinician says something the system did not anticipate. Everything about it is designed so that what they wrote survives intact and attributed to them.

Stable · v1.0 shadcn/ui WCAG 2.2 AA

Overview

Structured fields capture what was expected. A textarea captures everything else — the caveat, the context, the reason the model is wrong. That makes it the highest-value text in the record and the easiest to lose, because it is long, slow to write, and often typed during an interruption.

Never loses text

Nothing a clinician typed disappears — not on validation, not on navigation, not on session lock, not on a lost connection.

Never truncates silently

Limits are visible from the first keystroke. Text is never cut on save, and never cut on display.

Attributed

A draft belongs to whoever typed it. It never crosses an identity boundary without a decision.

Anatomy

Clinical free text
Draft saved 14:33:08 · S. Whitfield 241 / 2000
ElementRule
Label A real <label for>, permanently visible. Same rule as Text field.
Field Four rows minimum, vertically resizable, never horizontally. Text wraps; it never scrolls sideways.
Draft state When it was last saved and who it belongs to. On a shared workstation the second half matters as much as the first.
Counter Shown from the first keystroke where a limit exists, not from 80 % of it.

Rules

Drafts and identity

A draft belongs to whoever typed it

On a shared workstation an unsaved note is the most likely thing to be misattributed. A draft carries its author from the first keystroke, is never silently adopted by the next user, and on a user switch is either explicitly claimed or discarded with notice — see Sign in / sign out. An assessment recorded under the wrong clinician's name is a defect in the permanent record.

Do's and don'ts

Do
Draft saved 14:33 · S. Whitfield41 / 2000

Counter and owner from the start. The clinician knows the room they have and whose note this is.

Don't
Limit reached — text was shortened

A limit revealed by cutting the sentence. The clinical caveat is now half a sentence in a permanent record.

Do
You have an unsaved note
S. Whitfield started this note. It cannot be recorded under your name.

The draft cannot cross an identity boundary without a decision.

Don't
Signed in as A. Bergström
Your unsaved note has been restored.

Someone else's note silently re-attributed. The record now says Bergström wrote what Whitfield wrote.

Do

Plain text. What the clinician wrote is exactly what reaches the record system.

Don't

Rich text formatting that will not survive export, and may arrive in the record as markup a clinician has to read around.

Accessibility

Outcomes of use

What this contributes to, in the terms of Usability & context of use. These are attributes believed to contribute to an outcome; the outcome itself is settled by observing real use in a specified context, not by this page.

Clinical safety notes

Risk controls carried by this component

Trace these in your risk file (ISO 14971) and usability engineering file (IEC 62366-1).

Implementation

$ npx shadcn@latest add https://md.notjustany.tech/r/textarea.json
<Textarea
  label="Clinical note"
  maxLength={2000}          // counter shown from the first keystroke
  autosave="draft"
  authorId={currentUser.id} // draft is bound to whoever typed it
  onOwnerMismatch={promptClaimOrDiscard}
/>

// Over-limit blocks submission; it never trims.
if (value.length > maxLength) {
  return { ok: false, message:
    `Note is ${value.length - maxLength} characters over the limit. Shorten it to save.` }
}
NotJustAnyMed.Tech Design System · Textarea · v1.0 · draft for review
Reference applications named in this system are fictional; all clinical text shown is fabricated.