Skip to content
Components

Spotlight Background

Spotlight Background 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/spotlight-background.json

Use it

Scroll horizontally for long lines
"use client";
import {SpotlightBackground} from '@/components/jez-ui/ui/spotlight-background';

export default function Example(){

return <><SpotlightBackground 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">Find your focus.</h3><p className="mt-8 text-sm">Let the important things come forward.</p></div></SpotlightBackground></>;
}

Props & types

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

Source

View 2 source files

registry/ui/spotlight-background.tsx

Scroll horizontally for long lines
"use client";
import * as React from "react";
import { cn } from "./utils";
export function SpotlightBackground({
  children,
  className,
}: {
  children?: React.ReactNode;
  className?: string;
}) {
  const [x, setX] = React.useState(50);
  return (
    <div
      onPointerMove={(e) => {
        const r = e.currentTarget.getBoundingClientRect();
        setX(((e.clientX - r.left) / r.width) * 100);
      }}
      className={cn(
        "min-h-64 rounded-xl bg-[#161c22] p-8 text-white",
        className,
      )}
      style={{
        backgroundImage: `radial-gradient(ellipse at ${x}% 0%,#657765,transparent 70%)`,
      }}
    >
      {children}
    </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 →