Heartbeat
A looping ECG trace with a bright leading edge.
Bed 4 · AdultII · 25 mm/s
- HR
- 72
- SpO₂ %
- 98
- NIBP
- 118/76
Installation
npx shadcn@latest add https://neonkit.heyaadi.com/r/heartbeat.jsonUsage
import { Heartbeat } from "@/components/ui/heartbeat"
<Heartbeat bpm={72} />Examples
Rates
The sweep fits a whole number of beats on screen, so the rhythm stays true to bpm at any width.
Changing rate
Change bpm on the fly and the dot carries on from where it was.
Service health
A small strip as an is-it-alive signal. bpm={0} flatlines.
API reference
Renders a div with role="img" and accepts its attributes; the ref points at it. It fills its container's width.
| Prop | Type | Default |
|---|---|---|
bpm | numberBeats per minute. 0 draws a flat line. | 72 |
height | numberHeight in pixels. | 96 |
onBeat | () => voidCalled as each R peak passes the leading dot. Not called under reduced motion. | None |
color | NeonColorPalette name or hex. Falls back to --neon-accent, then cyan. | inherited |
Accessibility
- Screen readers hear "Heart rate 72 beats per minute". Pass aria-label for other meanings, such as a service being up.
- The strip is one SVG path drawn once; each frame only moves a gradient window and the dot, so nothing re-renders while it runs.
- It pauses while off screen or in a hidden tab, and keeps its place when it resumes.
- With reduced motion, the trace holds still with the dot near the right edge.