Try 'magnetic button'
View code

Number 103: Liquid metal ring

Specification

Catalogue
No. 103 of 110
Interaction
Hover, Press
Element
Button, Icon
Preview
Live component
Imports
react 19.3.1
Added

Notes

A chrome ring whose reflections slide round it like light on wet metal, with a soft halo wandering behind. It sits round a round send button.

It gives one important button a material of its own without colour, so it stands out on a calm page.

No WebGL: two conic gradients of greys turn at different speeds (7s and 4.2s, opposite ways) inside a 6px ring mask, with a radial shade that darkens both edges so the ring reads as a tube. The halo turns once every 6.4s. On a card it moves while hovered; on the entry page it moves for six seconds on arrival, then whenever the button is pointed at or focused, and a press sends one fast turn through the metal (0.9s, cubic-bezier(.22, 1, .36, 1)). Under reduced motion the metal stands still.

Changed from the library: CSS gradients instead of a shader, no reflections on neighbouring elements, no cursor dent.

Code

React and plain CSS
"use client";

import { useEffect, useState } from "react";
import type { LivePreviewProps } from "@/components/live/types";
import styles from "./liquid-metal-ring.module.css";

/** On the entry page the metal moves for a while on arrival, then rests until pointed at or pressed. */
const ARRIVAL_MS = 6000;
const SPIN_MS = 900;

function Ring({ playing, spin }: { playing: boolean; spin?: number }) {
  return (
    <span className={styles.wrap} data-running={playing || undefined} aria-hidden="true">
      <span className={styles.halo} />
      <span key={spin} className={styles.ring} data-spin={spin ? "" : undefined} />
    </span>
  );
}

function SendButton() {
  const [arriving, setArriving] = useState(true);
  const [pointing, setPointing] = useState(false);
  const [spin, setSpin] = useState(0);
  const [sent, setSent] = useState(false);

  useEffect(() => {
    const id = window.setTimeout(() => setArriving(false), ARRIVAL_MS);
    return () => window.clearTimeout(id);
  }, []);

  useEffect(() => {
    if (!spin) return;
    const id = window.setTimeout(() => setSent(true), SPIN_MS);
    return () => window.clearTimeout(id);
  }, [spin]);

  return (
    <div className={styles.detail}>
      <div className={styles.stack}>
        <Ring playing={arriving || pointing} spin={spin} />
        <button
          type="button"
          className={styles.send}
          aria-label="Send"
          onPointerEnter={() => setPointing(true)}
          onPointerLeave={() => setPointing(false)}
          onFocus={() => setPointing(true)}
          onBlur={() => setPointing(false)}
          onClick={() => {
            setSent(false);
            setSpin((s) => s + 1);
          }}
        >
          <svg width="22" height="22" viewBox="0 0 24 24" fill="none" aria-hidden="true">
            <path d="M12 19V5M6 11l6-6 6 6" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
          </svg>
        </button>
      </div>
      <p className={styles.status} aria-live="polite">
        {sent ? "Sent" : "Point at the button, or press it"}
      </p>
    </div>
  );
}

export default function LiquidMetalRing({ active, context }: LivePreviewProps) {
  if (context === "detail") return <SendButton />;
  return (
    <div className={styles.stack}>
      <Ring playing={active} />
    </div>
  );
}

More like this

Sphere of dots that parts for the pointer

Hover, PressPage sections

Balanced logo wall

Hover, PressPage sections

Context window meter

Hover, PressCharts and numbers

Magnetic button

Hover, PressButtons and toggles

Delete that asks where you clicked

Press, FeedbackButtons and toggles

Donut that changes period

Hover, PressCharts and numbers