OpenSourceUIOpenSourceUIOpensource UI
GitHub—
  1. Home
  2. Components
  3. Background-pattern
  4. Line Grid
Back to Background-patternComponents / Background-pattern

Line Grid

Free Background-pattern React component — LineGridPattern. MIT licensed, copy-paste ready for Next.js and Tailwind CSS.

Horizontal ruled lines with a soft paper gradient — editorial layouts, docs, and notebook-style sections.

Preview

Your content

Setup

How to use

Free for personal and commercial use. No UI attribution required. Include the MIT copyright notice when copying component source into your project. Read the MIT license.

  1. 1

    Run in your terminal:

    $npm install clsx tailwind-merge lucide-react
  2. 2

    Copy lib/cn.ts below. Skip if you already have cn().

  3. 3

    Copy the code below and create components/background-pattern/line-grid-pattern.tsx in your project.

  4. 4

    Import and render:

    Example

    import { LineGridPattern } from "@/components/background-pattern/line-grid-pattern";

    <LineGridPattern className="min-h-screen p-8"><article>Notes</article></LineGridPattern>

lib/cn.ts

1
2
3
4
5
6
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
 
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}

components/background-pattern/line-grid-pattern.tsx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { forwardRef, type HTMLAttributes, type ReactNode } from "react";
 
import { cn } from "@/lib/cn";
 
export interface LineGridPatternProps extends HTMLAttributes<HTMLDivElement> {
children?: ReactNode;
}
 
const LineGridPattern = forwardRef<HTMLDivElement, LineGridPatternProps>(
({ children, className, ...props }, ref) => {
return (
<div
ref={ref}
data-slot="line-grid-pattern"
className={cn(
"relative isolate overflow-hidden bg-[#f7f7f7]",
className,
)}
{...props}
>
<div
aria-hidden="true"
className="pointer-events-none absolute inset-0 -z-10 bg-[linear-gradient(168deg,#fefefe_0%,#f4f4f4_52%,#fafafa_100%)]"
/>
 
<div
aria-hidden="true"
className="pointer-events-none absolute inset-0 -z-10 [background-image:repeating-linear-gradient(to_bottom,transparent_0,transparent_21px,rgba(0,0,0,0.07)_21px,rgba(0,0,0,0.07)_22px)] [background-size:100%_22px]"
/>
 
{children}
</div>
);
},
);
 
LineGridPattern.displayName = "LineGridPattern";
 
export { LineGridPattern };
PreviousNext

On this

page

Jump to a section on this page.

  • lib/cn.ts
  • components/background-pattern/line-grid-pattern.tsx
Platinum slotAvailable

Feature your product here.

Sticky card next to every component — highest-intent placement.

Claim this card