About
A pill button in the primary colour with a sheen that sweeps between its fill and its label every few seconds. Renders a link when you pass href. Part of Midnight, the full template on 21st; also in the free Midnight Lite (MIT).
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Shimmer CTA Button to your project and fits it to your theme.
Code
How Shimmer CTA Button is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
import { useSyncExternalStore, type CSSProperties } from "react"
import { ArrowRight } from "lucide-react"
import { ShineButton } from "@/components/ui/shine-button"
const geist = "@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400..600&display=swap');"
// Midnight by day: warm paper, night-blue ink, one deep gold button with white text
const settings = {
label: "Start free",
duration: 3.5,
background: "#f7f5f0",
primary: "#a8803a",
primaryForeground: "#ffffff",
text: "#141a2e",
}
// Midnight by night, the template's own palette
const night: Partial<typeof settings> = {
background: "#0b1020",
primary: "#d9b77e",
primaryForeground: "#0b1020",
text: "#ece9e1",
}
// 21st marks its dark theme with .dark on <html>; the demo answers with Midnight by night
function useDark() {
return useSyncExternalStore(
(on) => {
const watch = new MutationObserver(on)
watch.observe(document.documentElement, { attributes: true, attributeFilter: ["class"] })
return () => watch.disconnect()
},
() => document.documentElement.classList.contains("dark"),
() => false,
)
}
export default function Demo(props: Partial<typeof settings>) {
const dark = useDark()
const s = { ...settings, ...props, ...(dark ? night : {}) }
const theme = {
"--primary": s.primary,
"--color-primary": s.primary,
"--primary-foreground": s.primaryForeground,
"--color-primary-foreground": s.primaryForeground,
"--ring": s.primary,
"--color-ring": s.primary,
"--background": s.background,
"--color-background": s.background,
background: s.background,
fontFamily: "Geist, ui-sans-serif, system-ui, sans-serif",
} as CSSProperties
return (
<div className="flex min-h-svh w-full flex-wrap items-center justify-center gap-3 px-6" style={theme}>
<style>{geist}</style>
<ShineButton size="xl" duration={s.duration} delay={0.6}>
{s.label}
<ArrowRight strokeWidth={1.75} />
</ShineButton>
<a
href="#"
className="inline-flex h-14 items-center rounded-full px-6 text-[17px] font-medium transition-colors hover:bg-[color-mix(in_oklab,currentColor_6%,transparent)]"
style={{ color: s.text }}
>
See how it works
</a>
</div>
)
}















