Skip to content
← Components

Animated Grid

Animated Grid 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/animated-grid.json

Use it

Scroll horizontally for long lines
"use client";
import { AnimatedGrid } from "@/components/jez-ui/ui/animated-grid";

export default function Example() {
  return (
    <>
      <AnimatedGrid 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">
            Always in motion.
          </h3>
          <p className="mt-8 text-sm">An underlying rhythm.</p>
        </div>
      </AnimatedGrid>
    </>
  );
}

Props & types

Scroll horizontally for long lines
Omit<
  React.ComponentProps<"div">,
  keyof {
    children?: React.ReactNode;
    className?: string;
    paused?: boolean;
  }
> & {
  children?: React.ReactNode;
  className?: string;
  paused?: boolean;
}

Source

View 2 source files

registry/ui/animated-grid.tsx

Scroll horizontally for long lines
"use client";
import * as React from "react";
import { cn } from "./utils";
export function AnimatedGrid({
  children,
  className,
  paused = false,
  ...rootProps
}: Omit<
  React.ComponentProps<"div">,
  keyof {
    children?: React.ReactNode;
    className?: string;
    paused?: boolean;
  }
> & {
  children?: React.ReactNode;
  className?: string;
  paused?: boolean;
}) {
  return (
    <div
      {...rootProps}
      className={cn(
        "relative min-h-60 overflow-hidden rounded-xl bg-background",
        className,
      )}
    >
      <div
        aria-hidden="true"
        className="absolute inset-0 opacity-60"
        style={{
          backgroundImage:
            "linear-gradient(var(--border) 1px,transparent 1px),linear-gradient(90deg,var(--border) 1px,transparent 1px)",
          backgroundSize: "48px 48px",
          animation: "jez-grid 8s linear infinite",
          animationPlayState: paused ? "paused" : "running",
        }}
      />
      <div className="relative 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 →