BodyMap
<co-body-map>BodyMap marks numbered lesions on front and back body outlines, with size in millimetres, change since last visit, status and dated photos for each one.
import { BodyMap } from 'health-components';
Examples
Back View Read Only
No Marks
Legacy Marks
Usage
<BodyMap marks={[{ x: 88, y: 92, view: "front", site: "Left upper chest", size: [6, 5], prevSize: 4, prevDate: "04/02/2026", type: "biopsy", desc: "Irregular border, two colors", photos: [{ date: "10/09/2026" }] }]} />
When to use
- Full skin exams, mole mapping, wound and pressure injury location, injection site rotation.
When not to use
- Comparing photos side by side at full size: a photo viewer.
- Wound measurements over time: a wound flowsheet.
Variants and states
| Variant | What it is |
|---|---|
| front / back | SegmentedControl with a count of marks on each side. |
| monitor | Primary pin, Monitor tag. |
| new | Amber pin, New tag. |
| biopsy | Red pin, Biopsy tag. |
| treated | Success tag. |
| size and change | Length by width in mm, and the earlier size and date when it has grown. |
| photos | Dated thumbnails; a camera placeholder when the image is not loaded yet; "No photos yet" when none. |
| selected | Click a pin: it gets a ring and its row highlights. |
| empty side | EmptyState for a view with no marks. |
Clinical values
Every number goes through the shared clinical value rules (CareOS.fmt and ClinicalValue from the clinical-values card): tabular digits, the unit always shown, a fixed precision per measure, the reference range in the tooltip, and H, L or critical flags. Medication amounts follow the ISMP dose style through fmt.doseNumber: rounded to the stated precision, then shown with no trailing zero (5 mg, never 5.0 mg) and a leading zero (0.5 mL). The specialty measures this card adds sit in CareOS.specialty.MEAS with their precision: lesion size whole mm. Ranges in the previews are sample values for the design system, not clinical guidance; a real deployment passes its own.
Accessibility
- The list repeats every mark in text with its number, so the drawing is never the only record.
- The SVG label says which side is the patient’s left in each view.
- Photos carry alt text with lesion number, site and date.
Do and don't
- Do: Number marks in the order they were found and keep the number across visits.
- Do: Record size at every visit so growth is visible.
- Don't: Rely on the drawing alone.
- Don't: Drop the date from a photo.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
marks | ReadonlyArray<BodyMapMark> | [] | Marks in a 200 by 262 frame |
view | BodyMapView | 'front' | First view shown (uncontrolled) |
currentView | BodyMapView | uncontrolled | Shown view (controlled) |
onViewChange | (view: BodyMapView) => void | none | Called when the view changes |
onMarkSelect | (n: number) => void | none | Called with the mark number when a pin is clicked |
title | string | 'Body map' | Card title |
subtitle | string | none | Line under the title (patient and date) |
readOnly | boolean | false | Hides Add Photo |
onAddPhoto | () => void | none | Add Photo action |
rangeContext | RangeContextId | the global context, else 'outpatient' | Which shared reference range flags use; the lab range on a result still wins |
Also accepts native attributes, including defaultChecked, defaultValue, autoFocus, plus className and event handlers on the root element.
Angular, Vue and HTML
Register the elements once (Angular guide), then use <co-body-map>. Attributes take strings; arrays and objects are set as properties (Angular [prop], Vue :prop) or as JSON attributes. Callbacks are DOM events with the value in event.detail.
<co-body-map view="…" current-view="…" [marks]="marks" (co-view-change)="onViewChange($event.detail)"></co-body-map>
| Kind | Name | Description |
|---|---|---|
| property / JSON attribute | marks | Marks in a 200 by 262 frame; default [] |
| attribute | view | First view shown (uncontrolled); default 'front' |
| attribute | current-view / currentView | Shown view (controlled); default uncontrolled |
| attribute | title | Card title; default 'Body map' |
| attribute | subtitle | Line under the title (patient and date); default none |
| attribute | read-only / readOnly | Hides Add Photo; default false |
| attribute | range-context / rangeContext | Which shared reference range flags use; the lab range on a result still wins; default the global context, else 'outpatient' |
| attribute | default-checked / defaultChecked | |
| property / JSON attribute | default-value / defaultValue | |
| attribute | auto-focus / autoFocus | |
| event | co-view-change | Called when the view changes; default none (React: onViewChange) |
| event | co-mark-select | Called with the mark number when a pin is clicked; default none (React: onMarkSelect) |
| event | co-add-photo | Add Photo action; default none (React: onAddPhoto) |