Components
Loading preview...
A background grid pattern made with SVGs, fully customizable using Tailwind CSS.
npx shadcn@latest add https://21st.dev/r/dillionverma/grid-pattern"use client";
import { cn } from "@/lib/utils";
import { GridPattern } from "@/components/ui/grid-pattern";
function GridPatternDemo() {
return (
<div className="relative flex h-[500px] w-full flex-col items-center justify-center overflow-hidden rounded-lg border bg-background md:shadow-xl">
<p className="z-10 whitespace-pre-wrap text-center text-5xl font-medium tracking-tighter text-black dark:text-white">
Grid Pattern
</p>
<GridPattern
squares={[
[4, 4],
[5, 1],
[8, 2],
[5, 3],
[5, 5],
[10, 10],
[12, 15],
[15, 10],
[10, 15],
[15, 10],
[10, 15],
[15, 10],
]}
className={cn(
"[mask-image:radial-gradient(400px_circle_at_center,white,transparent)]",
"inset-x-0 inset-y-[-30%] h-[200%] skew-y-12",
)}
/>
</div>
);
}
function GridPatternLinearGradient() {
return (
<div className="relative flex size-full items-center justify-center overflow-hidden rounded-lg border bg-background p-20 md:shadow-xl">
<p className="z-10 whitespace-pre-wrap text-center text-5xl font-medium tracking-tighter text-black dark:text-white">
Grid Pattern
</p>
<GridPattern
width={20}
height={20}
x={-1}
y={-1}
className={cn(
"[mask-image:linear-gradient(to_bottom_right,white,transparent,transparent)] ",
)}
/>
</div>
);
}
function GridPatternDashed() {
return (
<div className="relative flex size-full items-center justify-center overflow-hidden rounded-lg border bg-background p-20 md:shadow-xl">
<p className="z-10 whitespace-pre-wrap text-center text-5xl font-medium tracking-tighter text-black dark:text-white">
Grid Pattern
</p>
<GridPattern
width={30}
height={30}
x={-1}
y={-1}
strokeDasharray={"4 2"}
className={cn(
"[mask-image:radial-gradient(300px_circle_at_center,white,transparent)]",
)}
/>
</div>
);
}
export { GridPatternDemo, GridPatternLinearGradient, GridPatternDashed };