← Lab001 · Ferrofluid toggle

Lab 00122 Oct 2026

Ferrofluid toggle

A switch whose knob is a drop of magnetic liquid. It reaches for your cursor, stretches when you drag it, and wobbles into place.

How it works

The knob is one small fragment shader per switch. It draws a signed-distance blob, and the blob is the only thing that moves: a spring pulls it from one end of the track to the other, so it overshoots and settles like a heavy drop.

Twelve needle spikes grow out of the blob toward the pointer, the way ferrofluid lines up with a magnet’s field. They flare with the pointer’s speed and lie down when it leaves. Hold the pointer right above the knob and the surface breaks into hexagonal cones, the Rosensweig instability you see when a magnet sits under a dish of ferrofluid.

The shading is black chrome: the normal comes from the distance field, and it reflects a fake studio of softboxes. In dark mode a rim light picks out the edge so the drop doesn’t disappear into the page.

Under all that it’s a real switch: a button with role="switch", keyboard and focus support, and a still version for reduced motion. On a phone your finger is the magnet.

Recreate it

A prompt you can paste into a coding agent to build your own.

Build a toggle switch whose knob is a drop of ferrofluid, as a single HTML file.

- Keep it a real control: a <button role="switch"> with aria-checked, keyboard and focus styles, and a still version for prefers-reduced-motion.
- Draw the knob with one small WebGL2 fragment shader per switch: a signed-distance blob that a spring moves along the track, so it overshoots and wobbles.
- Grow 12 thin spikes from the blob toward the pointer, flaring with pointer speed. When the pointer hovers right above the knob, break the surface into hexagonal cones (the Rosensweig instability).
- Shade it like black chrome reflecting softboxes, and add a rim light in dark mode.
- On touch devices, the finger is the magnet.

How it happened

The real conversation, shortened. Charul’s words are in quotes; everything else is a summary of what happened.

  1. Charul

    We need to come up with some crazy sick ideas.

  2. Claude

    Pitched a list of experiments, one of them a ferrofluid toggle: a switch knob made of magnetic liquid that spikes toward the cursor.

  3. Charul

    Build the ferrofluid toggle prototype first.

  4. Claude

    Built the switch: an SDF blob on a spring, spikes toward the pointer, a droplet bridge when it moves fast, black-chrome shading, keyboard and reduced-motion support.

  5. Charul

    Make the spikes more dramatic and add rim light in dark mode.

  6. Claude

    Sharpened them into 12 needles that flare with pointer speed, added the hexagonal Rosensweig cones when the pointer is right above, and a rim light in dark mode.