Pro
Metronome
A pendulum metronome. The arm swings once per two beats and turns at each extreme exactly where the click falls; its weight slides down for faster tempos. The beats of the bar light in turn, the first accented.
pnpm dlx shadcn@latest add @caliper/metronomeWhen to use
Use it for
- Practice tools for musicians, dancers and runners.
- Any rhythm you want people to feel before they read it.
Skip it when
- Sample-accurate audio; the click is scheduled per frame, so use a look-ahead scheduler.
- Decoration with no sound or beat behind it.
Decisions
Why it is built this way, so you know what to keep when you change your copy.
Behaviour
- The arm is the beat
- The arm's angle is a cosine of the beat count, so it is at an extreme on each beat and moves fastest between them, as a real pendulum does.
- Tempo changes keep the phase
- Moving the slider while it runs changes the speed from where the arm is, so the beat never restarts.
Usage
- Silent until started
- The click is off until Start is pressed, can be muted, and the audio context is created by that press.
Installation
pnpm dlx shadcn@latest add @caliper/metronome
Adds its 4 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
Usage
Import it from your copy of the source. The example behind the preview comes with the source. It is built from Metronome, tapTempo and tempoName.
import { Metronome, tapTempo, tempoName, BPM_MIN, BPM_MAX } from "@/components/ui/metronome"
The worked example comes with Pro
The 23-line example behind the preview opens here, ready to copy.
- 626 Pro parts, blocks and page templates, all with source
- $149 once, with lifetime updates. No renewal
- A full refund within 14 days if it is not for you
API reference
Metronome
component
Also accepts the native props of its root element and a ref.
tapTempo
component
No props of its own; it accepts the native props of its root element.
tempoName
component
No props of its own; it accepts the native props of its root element.
BPM_MIN
helper
A helper exported alongside the component, not a component.
BPM_MAX
helper
A helper exported alongside the component, not a component.
Accessibility
It exposes status semantics, with aria-hidden, aria-label and aria-pressed kept in step with state. Changes that matter are announced through a live region.
No custom key handling; Tab and the native activation keys do the work.
Motion
It checks prefers-reduced-motion itself and settles immediately instead of travelling. Every state is still reachable.
Related
- Rotary knobA rotary control with a real edge. The knob is a short cylinder seen from above: a stack of discs gives it thickness, a ring of ticks lights up to the value, and the number is always written beside it. Drag it or use the keys; with detents on it clicks through every tenth.
- StopwatchTime something: start, pause, lap and reset. The reading is drawn every frame in tabular figures and measured from the clock, so a busy or hidden tab never loses time. The fastest and slowest laps are marked.
- CountdownA live countdown to a date, in a large or compact style.