Baktiyar Ablaikhan

Background Boxes

Source
Aceternity UI ↗
Author
Aceternity UI
Licence
Aceternity UI licence (free component)

Loading…

A skewed grid of cells lights up in random colours under the pointer.

Code

"use client";
import React from "react";
import { Boxes } from "@/lab/aceternity/ui/background-boxes";
import { cn } from "@/lib/utils";

export default function BackgroundBoxesDemo() {
  return (
    <div className="h-full relative w-full overflow-hidden bg-slate-900 flex flex-col items-center justify-center [container-type:inline-size]">
      <div className="absolute inset-0 w-full h-full bg-slate-900 z-20 [mask-image:radial-gradient(transparent,white)] pointer-events-none" />

      <Boxes />
      <h1 className={cn("text-[clamp(1.1rem,4.5cqw,2.25rem)] text-white relative z-20 pointer-events-none")}>
        Tailwind is Awesome
      </h1>
      <p className="text-center mt-2 text-neutral-300 relative z-20 pointer-events-none text-[clamp(0.7rem,1.8cqw,1rem)]">
        Framer motion is the best animation library ngl
      </p>
    </div>
  );
}
Prompt

Build "Background Boxes", a background animation. What it does: A skewed grid of cells lights up in random colours under the pointer. Write it as a single self-contained React component in TypeScript that fills its parent (w-full h-full), styled with Tailwind CSS, using motion. Technique: the Motion library, inline SVG. It sits on a dark background, in a 16:10 frame. Respect prefers-reduced-motion with a still state, pause work when the element is off screen, and keep it accessible. Original: https://ui.aceternity.com/components/background-boxes (Aceternity UI, Aceternity UI licence (free component)).