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.
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
| Element | Rule |
|---|---|
| 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
- Limits are generous and visible. If a limit exists it is shown from the start. A clinician who discovers it at 1 900 characters has already lost the sentence they were composing.
- Never truncate on save. Text over the limit blocks submission with a clear message; it is never quietly cut.
- Never truncate on display either. A note shown elsewhere in the record wraps and expands — see Card.
- Autosave as a draft, with the timestamp and owner visible. Drafts survive navigation, session lock and reconnection.
- No rich text. Bold, bullets and tables do not survive export to most record systems, and what survives is unpredictable. Plain text, plain meaning.
- Spellcheck on for prose, off for identifiers. A clinician typing a drug or an anatomical term should not fight autocorrect; an MRN field should not be spellchecked at all.
- Enter inserts a newline. It never submits a form containing a textarea.
Drafts and identity
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
Counter and owner from the start. The clinician knows the room they have and whose note this is.
A limit revealed by cutting the sentence. The clinical caveat is now half a sentence in a permanent record.
The draft cannot cross an identity boundary without a decision.
Someone else's note silently re-attributed. The record now says Bergström wrote what Whitfield wrote.
Plain text. What the clinician wrote is exactly what reaches the record system.
Rich text formatting that will not survive export, and may arrive in the record as markup a clinician has to read around.
Accessibility
- A real
<textarea>with an associated label. Never acontenteditablediv, which loses form semantics entirely. - The counter is wired with
aria-describedbyand announced at intervals, not on every keystroke. - Vertically resizable and never disabled from resizing, so a magnified user can make room.
- Draft-saved state announces politely, so a screen-reader user knows their work is held.
- Enter never submits. Submission is an explicit button, reachable by keyboard.
- 16 px minimum text, which also prevents zoom-on-focus on touch.
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.
- Effectiveness — the note in the record is what the clinician wrote, whole, under their name.
- Efficiency — no re-typing after an interruption, which is the dominant cost of free-text entry in a clinical setting.
- Satisfaction — willingness to write the caveat at all. A field that has lost text once will be used tersely for ever after.
Clinical safety notes
Trace these in your risk file (ISO 14971) and usability engineering file (IEC 62366-1).
- Never truncates on save or display. Mitigates: a clinical caveat entering the record as half a sentence.
- Limits visible from the first keystroke. Mitigates: composition lost at the limit.
- Drafts autosaved and attributed. Mitigates: loss of an assessment across an interruption or session lock.
- Drafts never cross an identity boundary silently. Mitigates: a misattributed clinical note in the permanent record.
- Plain text only. Mitigates: formatting lost or mangled on export, changing how a note reads.
- Enter does not submit. Mitigates: a partial note recorded mid-sentence.
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.` }
}
Related
- Text field — labels, hints, validation, identifier rules.
- Clinician override — the optional free-text reason.
- Sign in / sign out — drafts across a user switch.
- Voice & tone — how the surrounding copy is written.