Text that glitters like a cut stone under a spotlight: tiny four-point stars flare and fade across the letters, and the cursor showers a few more.
Lettering hot-stamped in metal foil, in gold, rose, champagne or silver: banded tones, a fine grain, a soft emboss, and a highlight that follows the cursor.
Customize
Usage
import { GoldFoilText } from "@/components/motionkit/gold-foil-text";
<GoldFoilText as="h1" className="font-serif text-7xl">
Maison Dorée
</GoldFoilText>Motion
The exact curves this component runs, plotted with Motion's own maths.
Light sweep
Runs on its own
Luxury brand names and logotypes, invitations and save-the-dates, award winners, VIP tiers and premium plan names.
The letters are clipped to a stack of backgrounds with background-clip: text, so they stay real, selectable text. The bottom layer is a gradient with alternating dark and bright bands, which is what reads as metal; a fine noise texture blended over it gives the grain of stamped foil. Above them, a narrow band of light slides across on a slow loop, and a soft radial highlight follows the pointer through CSS variables, while the bands tilt slightly as if the foil were turned. Three drop shadows make the emboss.
Works in the App Router as is. Requires Tailwind CSS v4.
One command adds the file and installs its dependencies. Needs a components.json (run npx shadcn@latest init once if you don't have one).
npx shadcn@latest add https://www.motionkitui.com/r/gold-foil-text.jsonnpm install motionSave as components/motionkit/gold-foil-text.tsx.
"use client";
import { useRef, type CSSProperties, type ElementType, type PointerEvent, type ReactNode } from "react";
const FOILS = {
gold: ["#5C3A0E", "#B8862B", "#F6DC8E", "#FFF6D8", "#C9962F", "#7A5216"],
rose: ["#5A2A24", "#B8735F", "#F2C2AE", "#FFF0E8", "#C98A75", "#7A3F33"],
champagne: ["#4F4231", "#A8916E", "#EADBC0", "#FFFBF1", "#BBA67F", "#6E5D45"],
silver: ["#2E3236", "#8D949B", "#DDE2E6", "#FFFFFF", "#A4ABB2", "#4E5459"],
} as const;
type GoldFoilTextProps = {
children: ReactNode;
/** The metal. */
foil?: keyof typeof FOILS;
/** The element to render, e.g. "h1". */
as?: ElementType;
/** Let the light follow the pointer across the letters. */
interactive?: boolean;
/** Seconds between slow sweeps of light while the pointer is elsewhere. 0 turns them off. */
sweep?: number;
className?: string;
};
// a fine grain makes it read as stamped foil rather than a flat gradient
const GRAIN =
"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\")";
/**
* Lettering hot-stamped in metal foil. Banded metallic tones and a fine grain give it the look of real foil, a soft
* emboss lifts it off the page, and a highlight follows the pointer across the letters, or sweeps by now and then.
*/
export function GoldFoilText({ children, foil = "gold", as: Tag = "span", interactive = true, sweep = 6, className = "" }: GoldFoilTextProps) {
const ref = useRef<HTMLElement>(null);
const [deep, base, light, peak, mid, dark] = FOILS[foil];
function move(event: PointerEvent) {
if (!interactive || event.pointerType === "touch") return;
const rect = ref.current!.getBoundingClientRect();
const x = ((event.clientX - rect.left) / rect.width) * 100;
const y = ((event.clientY - rect.top) / rect.height) * 100;
ref.current!.style.setProperty("--foil-x", `${x}%`);
ref.current!.style.setProperty("--foil-y", `${y}%`);
// the metal's bands tilt a little with the light, as a foil does when you turn it
ref.current!.style.setProperty("--foil-angle", `${100 + (x - 50) * 0.5}deg`);
ref.current!.dataset.lit = "";
}
function leave() {
delete ref.current?.dataset.lit;
ref.current?.style.setProperty("--foil-angle", "100deg");
}
const style = {
"--foil-x": "50%",
"--foil-y": "30%",
"--foil-angle": "100deg",
backgroundImage: [
// the pointer's highlight, faded in only while the pointer is over the text
"radial-gradient(circle at var(--foil-x) var(--foil-y), rgb(255 255 255 / var(--foil-glow, 0)), transparent 32%)",
// the slow sweep of light
sweep ? "linear-gradient(110deg, transparent 42%, rgb(255 255 255 / 0.75) 50%, transparent 58%)" : "linear-gradient(transparent, transparent)",
GRAIN,
`linear-gradient(var(--foil-angle), ${deep} 0%, ${base} 18%, ${light} 34%, ${peak} 42%, ${mid} 55%, ${light} 70%, ${base} 82%, ${dark} 100%)`,
].join(", "),
backgroundSize: "100% 100%, 300% 100%, 160px 160px, 100% 100%",
backgroundPosition: "0 0, 150% 0, 0 0, 0 0",
backgroundBlendMode: "normal, normal, soft-light, normal",
WebkitBackgroundClip: "text",
backgroundClip: "text",
color: "transparent",
// the emboss: a bright lip above and a soft shadow below, as stamped foil sits on paper
filter: `drop-shadow(0 -1px 0 rgb(255 248 225 / 0.25)) drop-shadow(0 1.5px 1px rgb(0 0 0 / 0.55)) drop-shadow(0 6px 14px ${dark}66)`,
animation: sweep ? `foil-sweep ${sweep}s ease-in-out infinite` : undefined,
} as CSSProperties;
return (
<>
<style>{`@keyframes foil-sweep{0%,55%{background-position:0 0,150% 0,0 0,0 0}100%{background-position:0 0,-50% 0,0 0,0 0}}[data-foil][data-lit]{--foil-glow:.85}@media (prefers-reduced-motion:reduce){[data-foil]{animation:none!important}}`}</style>
<Tag ref={ref} data-foil="" onPointerMove={move} onPointerLeave={leave} className={`inline-block ${className}`} style={style}>
{children}
</Tag>
</>
);
}
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | The text. |
| foil | "gold" | "rose" | "champagne" | "silver" | "gold" | The metal. |
| as | ElementType | "span" | Element to render, e.g. h1. |
| sweep | number | 6 | Seconds between slow sweeps of light. 0 turns them off. |
| interactive | boolean | true | Let the light follow the pointer. |
How we audit: the WCAG 2.2 animation checklist and respecting reduced motion in React.
Yes. The file starts with "use client", so you can import it straight into a Server Component page or layout. It works in Vite as is, and in Astro as a React island.
Nothing beyond React and Tailwind CSS v4. There is no MotionKit package and no Tailwind config to add.
Yes. Run npx shadcn@latest add https://www.motionkitui.com/r/gold-foil-text.json in any project with a components.json. It saves the file to components/motionkit and installs its dependencies.
With reduced motion on, the sweep stops; the pointer's highlight still follows, as it moves only when you do.
Text that glitters like a cut stone under a spotlight: tiny four-point stars flare and fade across the letters, and the cursor showers a few more.
A name revealed like a fashion house film opening: letters arrive spaced wide and out of focus, then draw together and sharpen, over a hairline rule and a subtitle.
Rotates through a list of words, letters rising in and drifting out.
Maison Dorée