INFINITYUI
HomeComponentsDocsTemplates
Star

Getting Started

  • Introduction
  • Installation
  • CLI
  • Audit

Navigation

  • Spotlight Navbar
  • Glass DockNEW
  • Animated Tab Bar
  • Circle Menu
  • Magnet Tabs
  • Animated Sidebar
  • Apple Spotlight
  • Page TOC RailNEW

Text

  • Flip Text
  • Glitch Text
  • Liquid Text
  • Flip Fade Text
  • Mask Cursor Effect

Cards

  • Glow Border Card
  • Testimonials Card
  • Interactive Book
  • Trading CardsNEW
  • Hover Image
  • Chain of ThoughtNEW
  • Masonry Grid
  • Image Pile
  • Staggered Grid

Inputs

  • AI InputNEW
  • OTP Input
  • Leave Rating

Buttons

  • Social Flip Button
  • Creepy Button

Loaders

  • Jelly Loader
  • Rolling Ball Scroll
  • Glowing Scroll

Backgrounds

  • Light Lines
  • Perspective Grid
  • Liquid Ocean
  • Eagle Vision
  • Flow Scroll
  • Horizontal Scroll

Overlays

  • PersonaNEW
  • Infinite Moving Cards
  • Masked Avatars
  • Stacked Logos
  • Icon Wheel
  • Pixelated CarouselNEW
  • Pixelated Image Trail
  • Flip Scroll
  • Interactive Folder
  • Animated Folder IconNEW
  • Stack Scroll
  • Rubik Cube
Backgrounds

Perspective Grid

#background#grid#perspective
implementedInfinityUI component

This component is fully implemented in InfinityUI and wired into the docs and registry flow.

Installation

Use the registry command to add the component source, and install any package dependencies if needed.

Infinity Registry

Install the component source into your project with the shadcn CLI.

npx shadcn@latest add https://infinityui-pearl.vercel.app/r/perspective-grid
Package Dependencies

Install the npm packages used by this component source.

npm install framer-motion

Component Code

Copy and paste this code into your component file.

tsx
"use client";

import { motion } from "framer-motion";

interface PerspectiveGridProps {
    /** Grid line color. Default: 'rgba(99,102,241,0.15)' */
    lineColor?: string;
    /** Number of columns. Default: 14 */
    columns?: number;
    /** Number of rows. Default: 10 */
    rows?: number;
    className?: string;
}

export function PerspectiveGrid({
    lineColor = "rgba(99,102,241,0.15)",
    columns = 14,
    rows = 10,
    className = "",
}: PerspectiveGridProps) {
    return (
        <div
            className={`relative w-full h-full overflow-hidden bg-zinc-950 ${className}`}
            aria-hidden="true"
        >
            {/* Perspective container */}
            <div
                className="absolute inset-x-0 bottom-0 h-[110%]"
                style={{
                    transform: "rotateX(60deg)",
                    transformOrigin: "bottom center",
                    perspective: "800px",
                    perspectiveOrigin: "50% 100%",
                }}
            >
                {/* Horizontal lines */}
                {Array.from({ length: rows + 1 }).map((_, i) => (
                    <motion.div
                        key={`h-${i}`}
                        className="absolute w-full h-px"
                        style={{
                            top: `${(i / rows) * 100}%`,
                            background: lineColor,
                            boxShadow: i === 0 ? `0 0 8px ${lineColor}` : "none",
                        }}
                        animate={{ opacity: [0.3, 0.8, 0.3] }}
                        transition={{ duration: 4, repeat: Infinity, delay: i * 0.2, ease: "easeInOut" }}
                    />
                ))}
                {/* Vertical lines */}
                {Array.from({ length: columns + 1 }).map((_, i) => (
                    <motion.div
                        key={`v-${i}`}
                        className="absolute h-full w-px"
                        style={{
                            left: `${(i / columns) * 100}%`,
                            background: lineColor,
                        }}
                        animate={{ opacity: [0.2, 0.6, 0.2] }}
                        transition={{ duration: 3, repeat: Infinity, delay: i * 0.1, ease: "easeInOut" }}
                    />
                ))}
            </div>

            {/* Fade out to top */}
            <div className="absolute inset-0 bg-gradient-to-b from-zinc-950 via-transparent to-transparent pointer-events-none" />
        </div>
    );
}