# Shimmer Button

> A dark button with a light sweep that draws the eye without shouting.

Category: Buttons · Free · Updated 2026-10-20 · Live demo: https://www.motionkitui.com/components/shimmer-button

## When to use it

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.

## How it works

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.

## Installation

```bash
npx shadcn@latest add https://www.motionkitui.com/r/shimmer-button.json
```

Or copy `components/motionkit/shimmer-button.tsx` below. Requires react, motion and Tailwind CSS v4. Free for personal projects; commercial use needs MotionKit Plus (https://www.motionkitui.com/pricing).

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `duration` | `number` | `2.4` | Seconds for one sweep of the shine. |
| `...props` | `motion.button props` |  | Any button or Motion prop. |

## Accessibility

- **Keyboard: Pass.** A native <button> with a visible focus ring.
- **Screen readers: Pass.** The light sweep is hidden from assistive tech; only the label is read.
- **Reduced motion: Partial.** 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.
- **Colour contrast: Pass.** Label text measures 16.7:1 against the button.

## Source

```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>
  );
}
```
