How it works
A textbook figure of Faraday's law. A bar magnet slides along the axis of a coil wired to a centre-zero voltmeter; the voltage induced is ε = −dΦ/dt, where Φ is the flux of the magnet through the coil. The needle and the trace under it show what the law predicts: no voltage while the magnet is still, a pulse one way while it approaches and the other way while it leaves, taller and shorter pulses for a faster pass, and the mirror image when the magnet is flipped. Each movement is kept as a trace, the current one in the accent colour and up to three before it in grey, and the line under the plot reads the two peaks of the last pass. Drag the magnet (or anywhere on the figure), or run a slow or a fast pass.
Use it for
- Teach Faraday's and Lenz's laws: the voltage depends on how fast the flux changes, not on how much flux there is.
- Compare a slow and a fast pass, or a flipped magnet, side by side on the same plot.
Look elsewhere when
- For real measurements from a data logger, use a time-series chart: this figure is an ideal model with a fixed coil and magnet.
Usage
import React from 'react'
import { MagneticTagRecorder } from './MagneticTagRecorder.jsx'
export function InductionLesson() {
return (
<MagneticTagRecorder
defaultPosition={-10}
onPass={({ peaks }) => console.log('peaks in mV', peaks)}
labels={{ title: 'Pass a magnet through a coil' }}
/>
)
}Props
| Prop | Type | Default | What it does |
|---|---|---|---|
defaultPosition | number | -10 | Where the magnet starts and returns on Reset, in centimetres from the centre of the coil, from −12 to 12. |
defaultFlipped | boolean | false | Start with the magnet flipped, south pole leading to the right. Reset returns to this. |
onPass | ({ peaks, samples }) => void | — | Called when a movement ends (half a second without motion): peaks lists the largest negative and positive voltages in mV in the order they happened, samples the trace as { t, v } in seconds and mV. |
labels | object | — | Replaces any built-in text: title, caption, magnet, positionText ('{x}', '{v}'), north, south, voltage, earlier, slow, fast, flip, hint, result ('{first}', '{second}'), single ('{first}'), none, voltUnit, timeUnit and reset. |
locale | string | 'en' | Language tag for the numbers. |
className | string | — | Extra class on the card, for example to set its width (30rem by default, never wider than its container). |
Accessibility
- The magnet is a slider: its value is the position in centimetres and its value text reads the position and the voltage. Arrow keys glide it 1 cm (Shift 4 cm), Home and End to the ends of the track, so a keyboard user produces a pass at a steady speed.
- Slow pass and Fast pass are buttons that run the magnet through the coil to the far side. The flip button is a toggle with aria-pressed and a name. Reset is a button, marked unavailable while nothing has changed.
- The line under the plot is a polite live region: it reads the two peak voltages of the last pass in the order they happened. The pass buttons point to it with aria-describedby.
- Dragging uses pointer capture and moves the magnet by the pointer's horizontal travel from anywhere on the figure, so it never jumps. The figure sets touch-action: pan-y, so a vertical swipe still scrolls the page; a cancelled gesture puts the magnet back and drops its trace.
- Colour is not the only key: the poles carry N and S, the meter has − and + ends and a number, and the legend names the current and the earlier traces.
Motion
The magnet moves at the speed of the pass (8 or 24 cm/s, 12 cm/s for keys) and the needle and the trace follow it frame by frame; a drag follows the pointer directly. With reduced motion a pass or a key move lands at once with its whole trace drawn, and nothing in the card transitions.
Add it to your project
Pro members copy a prompt and their coding agent installs the source, the same way as the free components.
MagneticTagRecorder.jsxmagnetic-tag-recorder.csstokens.cssREADME.md
Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.



