Controls

Metal Button

Preset
Variant
Inner shadow
Glow
Cursor bend
Reflections
Paused
Intensity
Preview
Reduced motion

Simulates prefers-reduced-motion for the demo. Off follows your system setting.

Keyboard stepping

Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.

Metal Button
Pro
New
Later

Unlimited projects, priority support.

Metal Button

A liquid metal ring with a wandering halo for buttons, icons, text and badges.

Installation

npx shadcn@latest add ikislay/pixel-ui/metal-button

How to use

import { useRef } from "react"
import { ArrowUp } from "lucide-react"
import { MetalBadge, MetalButton, MetalText, useMetalBend } from "@/components/ui/metal-button"
export function Demo() {
const ref = useRef<HTMLDivElement>(null)
useMetalBend(ref)
return (
<div className="flex items-center gap-6">
<MetalButton preset="chromatic">
<button className="rounded-full bg-black px-6 py-3 text-white">Upgrade to Pro</button>
</MetalButton>
<MetalButton ref={ref} variant="circle" innerShadow>
<button aria-label="Send" className="flex size-12 items-center justify-center rounded-full bg-black text-white">

Source Code

// Loading…

Props

Options you can pass to customize this component.

Prop
Type
Description
preset
chromaticsilvergold

The metal. Each one has a dark and a light tuning.

variant
buttoncircle

Button follows the child's corner radius; circle rounds the ring fully.

strength
number

From 0 to 1. Scales the opacity of the metal and its glow.

theme
lightdark

Picks the preset's tuning. Left unset, it follows the page's text color.

innerShadow
truefalse

Adds a light rim along the top inside edge of the ring.

reflectionTargets
RefObject<HTMLElement>[]

Neighbouring elements that catch a light rim on the edge facing the metal. It sets their box-shadow.

disableGlow
truefalse

Turns off the halo and the reflections.

glowGain
number

Multiplies the halo's brightness.

paused
truefalse

Freezes the flow. The cursor dent still works.

MetalText font
string

CSS font shorthand for the metal text, like "500 24px/1.2 Inter". Takes preset, theme, strength and paused too.

MetalText color
string

Tints the metal text, and colors it when WebGL is missing.

useMetalBend(ref)
RefObject<HTMLElement>

Pass the ref you gave MetalButton to dent the ring under the cursor.

useMetalTextReflection(metalRef, textRef)
RefObject<HTMLElement>

Makes a text element catch the halo with a soft colored text shadow.