Micro-interactions
Dial
A machined rotary knob: angular drag with detents you can feel on the way past, inertia on a flick, and a spring that settles into the nearest stop. The angle lives in a motion value rather than in React state — a drag writes it sixty times a second and a spring more often than that — so the only thing React holds is the detent index, and only when that integer actually changes. Arrow keys step through the same spring the hand does, so the keyboard is not a second, worse path to the same control.
Install
bun add motionProps
| Prop | Type | Default | Description |
|---|---|---|---|
| detents | number | 12 | Stops across the sweep. This is the resolution of the control and it changes how the drag feels as much as how it reads: few stops far apart give a decisive click between settings, many close together give something closer to a continuous ramp with a texture. |
| sweep | number | 270 | Angular range, centred on twelve o'clock. Two hundred and seventy is the instrument convention because it leaves a visible gap at the bottom — the eye reads the gap as the end of the scale, so both limits are legible without a label. At a full turn there are no ends to see. |
| stiffness | number | 380 | How hard the spring pulls toward the chosen stop after release. High makes a knob that arrives the instant you let go; low makes one with weight, where a flick keeps travelling for a moment after the finger is gone. |
| damping | number | 26 | How much of that spring's energy is absorbed. Below about fifteen the knob overshoots its stop and comes back, which reads as a loose detent rather than a machined one. |
| inertia | number | 0.6 | How far a flick carries past the point the hand let go. The throw is projected first and the nearest stop chosen second, so a fast spin travels several detents and settles — at zero the knob stops at whichever stop it happened to be passing, which throws the whole gesture away. |
| detentPull | number | 0.5 | Magnetism felt during the drag itself, before any release. The pull falls off toward the midpoint between two stops, so the exact centre is an unstable point the knob slides off rather than a flat spot it can rest in — which is what makes a detent feel like a notch instead of a suggestion. |
| ticks | "line" | "dot" | "none" | "line" | How the stops are marked on the panel around the knob. The scale never turns with the pointer — a mark that moves with the thing it is measuring tells you nothing about where you are. |
| readout | boolean | true | The value under the knob, set in tabular figures so the number does not shuffle sideways as it counts. |
| accent | string (hex) | "#a855f7" | The lit tick, the pointer line, and the live half of the readout. |
| size | number | 160 | Knob diameter. Everything inside is drawn against a fixed grid and scaled, so the knurling, the bevel and the pointer keep their proportions at any size. |
What It Demonstrates
- Drag
- Moving an element by grabbing it, often with momentum when released.
- Momentum
- Motion that carries velocity, especially after a drag or interruption.
- Velocity
- How fast and in which direction an element is moving. A spring carries it into the next animation when interrupted, so a flicked element keeps its speed.
- Spring
- Motion driven by physics (tension, mass, damping) rather than a set duration.
- Stiffness / Tension
- How strongly the spring pulls toward its target. Higher feels snappier.
- Damping
- How quickly a spring settles. Lower damping means more bounce and oscillation.
- Interruptible animation
- An animation that can be smoothly redirected mid-flight instead of finishing first.
- Stepped animation
- An animation that is divided into discrete steps, like a countdown timer.
- Rotate
- Spin an element around a point.
Related Components
Lens
A glass lens you drag across live content, bending it through an SVG displacement field with a real bevel and three-channel dispersion. It refracts a live duplicate of its own children rather than the page backdrop — which is the only version of this effect that works in Chrome, Safari and Firefox alike.
Stagger Menu
A menu overlay that blooms open as a clip-path circle spring while items stagger in with blur and rotation, then collapses back to its pill.
Magnetic Button
A button that leans into your cursor — caught in a magnetic field it slides toward the pointer while an amethyst aura swells with proximity, then snaps home on a spring and answers every click with a dark ripple bursting outward from the point of contact.
Shadow Cursor
A custom cursor with a shadow at its heel — a precise dot leads while a lagging blade trails on a spring, and when it crosses an interactive element the trail pools and swells around it, inverting whatever lies beneath. Scoped entirely to its own stage; the page cursor is never touched.
Segmented
A segmented control whose indicator travels on a shared layout id and smears in the direction it is moving.
Reorder
A sortable list that answers to a finger and to a keyboard equally — grab a row, and the rest step aside to make the space.