Grid Background
Installation
1
Install the following packages if you do not have it.
npm i framer-motion lucide-react
2
Copy and paste the following code into your project.
export default function GridBackground() {
return (
<div className="relative h-[500px] w-full flex flex-col justify-center items-center">
{/* Background */}
<div className="absolute inset-0 -z-10 overflow-hidden">
<div className="absolute left-1/2 top-0 -translate-x-1/2 w-screen h-full dark:[mask-image:linear-gradient(white,transparent)]">
<div className="absolute inset-0 bg-gradient-to-r from-[#36b49f] to-[#DBFF75] opacity-40 [mask-image:radial-gradient(farthest-side_at_top,white,transparent)] dark:from-[#36b49f]/30 dark:to-[#DBFF75]/30 dark:opacity-100">
<svg
aria-hidden="true"
className="absolute inset-x-0 inset-y-[-50%] h-[200%] w-full skew-y-[-18deg] fill-black/40 stroke-black/50 mix-blend-overlay dark:fill-white/2.5 dark:stroke-white/5"
>
<defs>
<pattern
id="grid-pattern"
width="72"
height="56"
patternUnits="userSpaceOnUse"
x="-12"
y="4"
>
<path d="M.5 56V.5H72" fill="none" />
</pattern>
</defs>
<rect
width="100%"
height="100%"
strokeWidth="0"
fill="url(#grid-pattern)"
/>
</svg>
</div>
</div>
</div>
{/* Text */}
<span className="pointer-events-none py-2 whitespace-pre-wrap bg-gradient-to-b from-black to-gray-300/80 bg-clip-text text-center text-5xl font-semibold leading-none text-transparent dark:from-white dark:to-slate-900/10">
Grid Background
</span>
</div>
);
}
3