Skip to content
Components

Border Beam

Border Beam adds a distinctive visual surface to your composition.

Open ↗

Make it yours.

Install the editable source and its dependencies into your React + Tailwind project.

Scroll horizontally for long lines
pnpm dlx shadcn@4.0.8 add http://localhost:3000/r/border-beam.json

Use it

Scroll horizontally for long lines
"use client";
import {BorderBeam} from '@/components/jez-ui/ui/border-beam';

export default function Example(){

return <><BorderBeam className="min-h-[360px]"><div className="flex min-h-64 flex-col justify-between"><h3 className="max-w-md font-display text-5xl font-medium leading-[1.03] tracking-tight md:text-6xl">Worth a closer look.</h3><p className="mt-8 text-sm">A detail that draws you in.</p></div></BorderBeam></>;
}

Props & types

Scroll horizontally for long lines
{
  children?: React.ReactNode;
  className?: string;
  paused?: boolean;
}

Source

View 2 source files

registry/ui/border-beam.tsx

Scroll horizontally for long lines
"use client";
import * as React from "react";
import { cn } from "./utils";
export function BorderBeam({
  children,
  className,
  paused = false,
}: {
  children?: React.ReactNode;
  className?: string;
  paused?: boolean;
}) {
  return (
    <div
      className={cn("rounded-xl p-px", className)}
      style={{
        background:
          "linear-gradient(110deg,var(--border) 20%,var(--primary) 40%,var(--accent) 50%,var(--border) 70%)",
        backgroundSize: "200% 100%",
        animation: "jez-shift 4s linear infinite",
        animationPlayState: paused ? "paused" : "running",
      }}
    >
      <div className="rounded-[11px] bg-background p-8">{children}</div>
    </div>
  );
}

registry/ui/utils.ts

Scroll horizontally for long lines
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...values: ClassValue[]) {
  return twMerge(clsx(values));
}

Dependencies

clsx@2.1.1 · tailwind-merge@3.5.0

Accessibility & behaviour

Respect reduced-motion preferences. Decorative effects must not carry essential information. WebGL scenes include a static fallback and only render while visible.

Read the accessibility and performance guide →