A call to action whose arrow slides out on hover while a fresh one slides in from the left. Pure CSS, solid or outline.
A dark button with a light sweep that draws the eye without shouting.
Customize
Usage
import { ShimmerButton } from "@/components/motionkit/shimmer-button";
<ShimmerButton>Upgrade to Pro</ShimmerButton>Motion
The exact curves this component runs, plotted with Motion's own maths.
Light sweep
Runs on its own
A secondary call to action that should still be noticed, such as "Start free trial" beside a plainer "Book a demo". It also suits dark hero sections, where a solid bright button would feel heavy.
A narrow, angled band of light sits inside the button and Motion slides it from left to right on a loop, with a short rest between sweeps. A soft radial glow under the label brightens on hover, and the button lifts two pixels. With reduced motion on, the sweep and the lift are removed.
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/shimmer-button.jsonnpm install motionSave as components/motionkit/shimmer-button.tsx.
"use client";
import type { ComponentProps, ReactNode } from "react";
import { motion, useReducedMotion } from "motion/react";
type ShimmerButtonProps = Omit<ComponentProps<typeof motion.button>, "ref" | "children"> & {
children?: ReactNode;
/** Seconds for one sweep of the shine. */
duration?: number;
};
export function ShimmerButton({
duration = 2.4,
className = "",
children,
...props
}: ShimmerButtonProps) {
const reduceMotion = useReducedMotion();
return (
<motion.button
whileHover={reduceMotion ? undefined : { y: -2 }}
whileTap={{ scale: 0.97 }}
className={`group relative isolate inline-flex items-center justify-center gap-2 overflow-hidden rounded-xl border border-[#2E9098]/40 bg-[#0C1010] px-5 py-3 text-sm font-medium text-[#E6F2F3] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#5FAEB4] ${className}`}
{...props}
>
{/* soft under-glow that brightens on hover */}
<span
aria-hidden
className="absolute inset-0 -z-10 rounded-xl bg-[radial-gradient(120%_120%_at_50%_120%,rgb(14_124_134/0.45),transparent_60%)] opacity-70 transition-opacity group-hover:opacity-100"
/>
{!reduceMotion && (
<motion.span
aria-hidden
initial={{ x: "-120%" }}
animate={{ x: "220%" }}
transition={{ duration, repeat: Infinity, ease: "easeInOut", repeatDelay: 0.6 }}
className="pointer-events-none absolute inset-y-0 left-0 w-1/2 -skew-x-12 bg-gradient-to-r from-transparent via-white/25 to-transparent"
/>
)}
<span className="relative inline-flex items-center gap-2">{children}</span>
</motion.button>
);
}
| Prop | Type | Default | Description |
|---|---|---|---|
| duration | number | 2.4 | Seconds for one sweep of the shine. |
| ...props | motion.button props | — | Any button or Motion prop. |
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.
Only the motion package, beside 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/shimmer-button.json in any project with a components.json. It saves the file to components/motionkit and installs its dependencies.
The sweep and hover lift are removed for reduced-motion users. It loops forever otherwise, so if it sits beside other content for more than 5 seconds, WCAG 2.2.2 asks you to add a pause control.
A call to action whose arrow slides out on hover while a fresh one slides in from the left. Pure CSS, solid or outline.
A button that leans toward the cursor with a springy, physical pull.
A button that fills while held, so destructive actions can never happen by accident.