UniqueUI

Moving Border

SVG-path-tracing animated border that orbits a button or card.

npx uniqueui add moving-border

Preview

Usage

import { Button } from "@/components/ui/moving-border";

export default function Example() {
  return (
    <div className="flex flex-wrap gap-6 items-center justify-center p-10">
      <Button
        borderRadius="1.75rem"
        className="bg-zinc-950 text-white border-neutral-200 dark:border-slate-800"
      >
        Click me
      </Button>
      <Button
        borderRadius="1rem"
        className="bg-zinc-950 text-white border-neutral-200 dark:border-slate-800"
        containerClassName="h-12 w-48"
      >
        Rounded Button
      </Button>
    </div>
  );
}

Props

PropTypeDescription
theme"light" | "dark"Visual theme; light or dark. Default: dark.
borderRadiusstringThe radius for rounding the button edges and the orbiting path.
childrenReact.ReactNodeThe label or content displayed inside the button.
asReact.ElementTypeThe HTML element tag to use for the button wrapper (e.g., 'button', 'div').
containerClassNamestringAdd CSS classes to the outermost container.
borderClassNamestringAdd CSS classes directly to the moving animated SVG border.
durationnumberTime in milliseconds to complete one full orbit around the border.
classNamestringAdd CSS classes to the inner content layer.