Skip to content
Plinth

Buttons

Liquid Metal Button

A polished chrome button whose reflection comes from a conic gradient, with a specular highlight that travels across the face.

#button#metal#conic-gradient#specular#chrome

Install

npx shadcn@latest add https://plinthui.com/r/liquid-metal-button.json
Open in v0
// A hover transition and a keyframed sweep are both pure CSS, so this stays a
// server component. Conic gradients and layered inset shadows are outside what
// Tailwind can express.
const css = `
.metal {
  position: relative;
  border: 0;
  padding: 18px 44px;
  border-radius: 999px;
  font: 600 17px/1 system-ui, sans-serif;
  letter-spacing: 0.02em;
  color: #06070c;
  cursor: pointer;
  isolation: isolate;
  overflow: hidden;
  /* A conic gradient IS the metal. Chrome is not a colour, it is a pattern of
     light and dark sweeping around the surface as the viewing angle changes —
     a conic sweep with repeated light/dark stops reproduces exactly that, and
     no linear gradient can, because a linear ramp has only one direction. */
  background: conic-gradient(
    from 210deg at 50% 40%,
    #f4f6fb 0deg,
    #2b3346 42deg,
    #ffffff 78deg,
    #161b28 120deg,
    #e8ecf5 168deg,
    #232a3a 214deg,
    #fdfefe 262deg,
    #1b2130 306deg,
    #f4f6fb 360deg
  );
  box-shadow:
    /* A dark hairline first, so the pale metal has an edge against any ground. */
    0 0 0 1px rgba(10, 12, 20, 0.55),
    /* Inset highlight top, inset shadow bottom: the two cues that read as a
       rounded, physically lit surface rather than a flat disc. */
    inset 0 1.5px 0 rgba(255, 255, 255, 0.95),
    inset 0 -2px 3px rgba(20, 24, 40, 0.4),
    0 10px 26px rgba(0, 0, 0, 0.45);
  transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 180ms ease;
}

/* The travelling specular. A steep, narrow white band swept across the face is
   what makes metal look wet rather than merely shiny — the highlight has to
   MOVE relative to the surface, because a static one is indistinguishable from
   a painted stripe. */
.metal::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(
    100deg,
    transparent 38%,
    rgba(255, 255, 255, 0.9) 48%,
    rgba(255, 255, 255, 0.35) 54%,
    transparent 62%
  );
  transform: translateX(-60%);
  animation: metal-sweep 4.6s ease-in-out infinite;
  pointer-events: none;
}

/* Keeps the label above both the conic ground and the sweep. */
.metal__label { position: relative; z-index: 1; }

@keyframes metal-sweep {
  0%, 12%   { transform: translateX(-60%); }
  62%, 100% { transform: translateX(60%); }
}

.metal:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px rgba(10, 12, 20, 0.6),
    inset 0 1.5px 0 rgba(255, 255, 255, 1),
    inset 0 -2px 3px rgba(20, 24, 40, 0.45),
    0 16px 34px rgba(0, 0, 0, 0.5);
}

.metal:active { transform: translateY(0); }

.metal:focus-visible {
  outline: 2px solid #8ab4ff;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .metal::before { animation: none; transform: translateX(0); opacity: 0.5; }
  .metal { transition: none; }
}
`;

export function LiquidMetalButton({ children = 'Get the kit' }: { children?: React.ReactNode }) {
  return (
    <>
      <style>{css}</style>
      <button className="metal" type="button">
        <span className="metal__label">{children}</span>
      </button>
    </>
  );
}

More in Buttons

Similar tags