Start a project

// Text & type

001 / 112

A metallic headline with a band of light that follows the pointer and sweeps on its own when idle.

Loading…

The code

All of it, in one file: the component above, restyle included. Nothing imported but React.

"use client";
/** SheenHeadline — metallic fill with a band of light. Follows the pointer; sweeps on its own when idle. React only. */
export default function SheenHeadline({ text = "Sheen headline" }: { text?: string }) {
  return (
    <h3
      className="sh"
      onPointerMove={(e) => {
        const b = e.currentTarget.getBoundingClientRect();
        e.currentTarget.style.setProperty("--x", `${((e.clientX - b.left) / b.width) * 100}%`);
        e.currentTarget.dataset.on = "1";
      }}
      onPointerLeave={(e) => delete e.currentTarget.dataset.on}
    >
      {text}
      <style dangerouslySetInnerHTML={{ __html: `
@property --x{syntax:'<percentage>';inherits:true;initial-value:-30%}
.sh{margin:0;font-family:var(--f-display,system-ui);font-stretch:87.5%;font-weight:600;font-size:clamp(36px,5vw,68px);letter-spacing:-.04em;line-height:1;text-transform:uppercase;color:transparent;-webkit-background-clip:text;background-clip:text;background-image:linear-gradient(100deg,#6b6b6b calc(var(--x) - 22%),#fff var(--x),#6b6b6b calc(var(--x) + 22%));animation:sh-sweep 3.6s ease-in-out infinite}
.sh[data-on]{animation:none}
@keyframes sh-sweep{0%{--x:-30%}100%{--x:130%}}` }} />
    </h3>
  );
}

23 lines · 1.2K · SheenHeadline.tsx

Props

PropDefault
text"Sheen headline"

Theme tokens it reads

Set these on :root to re-skin it. Each has a fallback, so it also works with none of them defined.

VariableFallbackWhat it does
--f-displaysystem-uiDisplay face for big type (a condensed variable font reads best).

Or install it

Published to a shadcn-style registry, so one command fetches the file straight into your project.

npx shadcn@latest add https://your-domain.com/r/sheen-headline.json

Placeholder domain — set NEXT_PUBLIC_SITE_URL to your deployed origin and the command updates.

// Next up