Components · Structure

Tabs

Peer views of one subject, only one visible at a time. Tabs are the only structural component whose entire purpose is to hide things — which is why their rules are about what may never be hidden.

Stable · v1.0 shadcn/ui WCAG 2.2 AA

Overview

Tabs solve a real problem — a subject with several equally valid views that will not fit on one screen. They solve it by concealment, and concealment in clinical software is the mechanism behind most of the failure modes elsewhere in this system: the filtered-out patient, the collapsed queue, the value below the fold.

So the component is permitted, narrowly, with one governing rule: nothing a clinician needs in order to notice something may live behind a tab.

Peer views

Tabs hold alternative views of one subject, never steps in a sequence and never unrelated destinations. If the tabs are a workflow, it is a wizard; if they are places, it is navigation.

Nothing urgent hidden

An active alarm is never behind a tab. Where a hidden panel holds something waiting, the tab says how much.

Addressable

The selected tab is in the URL. A clinician can send a colleague the view they are looking at, and the browser's back button does what it says.

Anatomy

Tabs with pending counts

12-lead ECG

Critical
STEMI pattern — anterior V2–V4. ST elevation 3.1 mm.
HARLAND, A. · acquired 14:26:38 · Bay 4 cart
ElementRule
Tab label Names the content, not the category. "Troponin", not "Labs". One or two words, never truncated.
Count How many items are waiting in that panel. This is what makes hiding acceptable — without it, an empty-looking tab and a full one are identical.
Selected indicator 2 px --primary underline and full-contrast text. Never colour alone.
Panel One subject's alternative view. Never a different patient, never a different encounter.

What may never be behind a tab

The governing rule

An active Critical or Urgent alarm is never concealed by a tab. If a condition arises in a hidden panel, the alarm renders in the docked region above the tabs, where it is visible regardless of which tab is selected — see Alert Banner. The tab additionally marks itself, so the clinician knows where to go, but the alarm does not wait there.

Alarm arising in a hidden panel

The alarm is docked above and fully readable without changing tab. The Troponin tab marks itself so the clinician knows where the evidence is — it does not have to be found.

Structure

Do

Three peer views of one patient. Counts make the hidden content countable.

Don't

A sequence, an unrelated destination and a support page in one strip. None of these are peer views of a subject.

Do's and don'ts

Do

Counts make the hidden content countable, which is what buys the right to hide anything.

Don't

No counts. A tab with two unreviewed results looks exactly like an empty one.

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/tabs.json
<Tabs defaultValue="ecg" syncToUrl activationMode="manual">
  <TabsList aria-label="Patient record">
    <TabsTrigger value="ecg">ECG</TabsTrigger>
    <TabsTrigger value="troponin" count={2}>Troponin</TabsTrigger>
    <TabsTrigger value="prior">Prior studies</TabsTrigger>
  </TabsList>
  <TabsContent value="ecg" keepMounted>…</TabsContent>
</Tabs>

// Alarms are hoisted out of panels into the docked region, so they are
// visible whichever tab is selected. Enforced, not left to the call site.
if (panelContainsAlarm(child) && !hoisted) {
  throw new Error(
    "[Tabs] an AlertBanner at critical/urgent cannot render inside a TabsContent. " +
    "Hoist it to the docked alert region and mark the trigger instead."
  )
}
PropTypeDefaultNotes
defaultValuestring Required. Stable; never restored from previous session.
syncToUrlbooleantrue Selected tab is addressable and back-navigable.
activationModemanual | automatic manualAutomatic warns for panels that fetch.
countnumber Included in the accessible name, not just rendered.
keepMountedbooleantrue Panels retain view state across switches.
NotJustAnyMed.Tech Design System · Tabs · v1.0 · draft for review
Reference applications named in this system are fictional; all patient data shown is fabricated.