Start a project

// Buttons & inputs

011 / 112

A point of light travelling the border of a button, leaving a short conic trail.

Loading…

The code

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

"use client";
/** ShimmerBorder — a point of light travelling the border, leaving a short conic trail. React only. */
export default function ShimmerBorder({ label = "Get started" }: { label?: string }) {
  return (
    <button className="sb">
      <span>{label}</span>
      <style dangerouslySetInnerHTML={{ __html: `
@property --a{syntax:'<angle>';inherits:false;initial-value:0deg}
.sb{position:relative;padding:18px 32px;border-radius:999px;background:#0a0a0a;font-size:18px;letter-spacing:-.02em}
.sb::before{content:"";position:absolute;inset:0;border-radius:inherit;padding:1.5px;background:conic-gradient(from var(--a),transparent 0 70%,#ff630f 90%,#fff 100%);-webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask-composite:exclude;animation:sb-spin 3s linear infinite}
.sb::after{content:"";position:absolute;inset:0;border-radius:inherit;border:1px solid rgba(255,255,255,.12)}
.sb span{position:relative}
@keyframes sb-spin{to{--a:360deg}}` }} />
    </button>
  );
}

17 lines · 1.0K · ShimmerBorder.tsx

Props

PropDefault
label"Get started"

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/shimmer-border.json

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

// Next up