Components · Feedback & status

Tooltip

A short label that appears on hover or focus. It is the component most likely to be handed information it must not hold, because it is the easiest place to put something when a layout is full.

Stable · v1.0 shadcn/ui WCAG 2.2 AA SC 1.4.13

Overview

This system bans hover as a sole carrier of information — see Interaction states — which puts the tooltip in an awkward position. The resolution is not to forbid it, but to be exact about what it is for: a tooltip supplements something already visible. It never carries anything a clinician needs in order to act.

Roughly half the surfaces this system targets are touch-only, where hover does not exist at all. A tooltip on a cart display is not a degraded experience — it is nothing. Anything that would be lost there was never safe to put in a tooltip.

Supplementary

Removing every tooltip in the product must change nothing about what a clinician can do or decide. If it does, that content belongs on the page.

Reachable

Hover, keyboard focus and long-press all open it. A tooltip only a mouse can reach is unavailable to most of the people using it.

Brief

A few words naming a thing. A tooltip containing a sentence is a popover; one containing a decision is a defect.

Anatomy

Tooltip on an icon-only control
Compare with prior ECG
Acute coronary syndrome ACS

Both bubbles are shown open so they can be read here. In use they appear on hover, focus or long-press, one at a time.

ElementRule
Trigger An interactive control, or an <abbr>. Never a bare span — a tooltip on something unfocusable is unreachable by keyboard.
Bubble Inverse surface, one line where possible, 200 px maximum when wrapping.
Relationship aria-describedby. The control still carries its own accessible name via aria-label — the tooltip does not supply it.
A tooltip is not an accessible name

An icon-only button needs both an aria-label (so assistive technology and voice control can name it) and a tooltip (so a sighted user can discover what the glyph means). Using the tooltip as the label leaves the control unnamed for anyone not hovering it; using the label alone leaves a sighted clinician guessing at an icon under time pressure.

What must never go in a tooltip

NeverBecauseInstead
Units of a measurementThe value becomes unitless on touch and in print Permanent suffix or label — Text field
A confidence scoreReliance information must be visible at the moment of the decisionConfidence disclosure
Patient identifiersIdentity is never conditional on a pointer Patient header
An error or validation messageErrors must persist and be announced Inline error text with aria-describedby
The full text of a truncated clinical valueTruncation of clinical content is itself prohibitedWrap, reflow, or shorten the label
Anything needed to choose between two actionsDecisions are not made by hoveringVisible helper text, or a Dialog

What a tooltip is legitimately for

Behaviour

WCAG 2.2 SC 1.4.13 sets three requirements for content shown on hover or focus, and all three are met by the component rather than by each call site.

RequirementImplementation
Dismissible Esc closes without moving the pointer or focus.
Hoverable The pointer can travel into the bubble without it closing — so a magnified user can reach content that overlaps their cursor.
Persistent Stays until dismissed, focus moves, or the pointer leaves. Never auto-hides on a timer.

Writing it

Do
Acknowledge alarm

Names the action. The button is independently labelled, so nothing is lost on a touch display.

Don't
47 ng/L · conf 0.71 · v4.2 47

Unit, confidence and model version behind a hover. On a cart display this is the number 47, unqualified, in a clinical record.

Do's and don'ts

Do
Acknowledge alarm

Tooltip and aria-label both present. Nothing is lost on a touch display.

Don't
Acknowledge alarm

The tooltip used as the accessible name. Voice control and screen readers have nothing to call this button.

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/tooltip.json
// Radix Tooltip gives dismissible / hoverable / persistent for free.
<Tooltip content="Compare with prior ECG">
  <Button size="icon" variant="outline" aria-label="Compare with prior ECG">
    <CompareIcon aria-hidden />
  </Button>
</Tooltip>

// Development guard: the tooltip must not be doing the label's job.
if (content === trigger.props["aria-label"]) {
  console.warn("[Tooltip] duplicates the accessible name — remove one.")
}
PropTypeDefaultNotes
contentstring Plain text only. Rich content means you wanted a Dialog or popover.
openDelaynumber400 Ignored for keyboard focus, which opens immediately.
sidetop | right | bottom | lefttop Auto-flips to stay in the viewport and clear of the alert region.
NotJustAnyMed.Tech Design System · Tooltip · v1.0 · draft for review
Reference applications named in this system are fictional; all patient data shown is fabricated.