Glin UI
Background / PatternAdapted from Magic UIbeta

Grid Pattern

SVG grid, stripes and interactive cell patterns with edge fades.

Edit on GitHub
Open source

A typed API client in every language

Generate SDKs from your OpenAPI spec on every merge and publish them to npm, PyPI and Maven without leaving CI.

Works with

  • Vercel
  • GitHub
  • Cloudflare
  • Astro

Installation

Install from
pnpm dlx @glinui/cli@latest add grid-pattern

Credits. Adapted from Magic UI (MIT, (c) Magic UI). Merged grid, interactive and stripes variants, token colors, collision free SVG ids, CSS only hover cells and edge fade masks. Attribution details.

Prefer the package?

Usage

Use the fade prop (or your own mask) so the pattern dissolves toward the edges. Interactive cells need pointer events: content layered above the pattern will intercept them, and the cell count is capped at 1600.

Highlighted squares pulse only at motion level full.

Variants

Plain grid, dashed grid and the stripes variant.

Grid
Dashed
Stripes
import { GridPattern } from "@glinui/ui"
export function Variants() {
return (
<div data-glin-theme="dark" className="grid w-full gap-3 sm:grid-cols-3">
<div className="relative isolate flex h-44 items-end overflow-hidden rounded-xl bg-[var(--surface-0)] p-3">
<GridPattern fade="radial" />
<span className="relative z-10 rounded-full bg-black/70 px-2.5 py-1 text-xs font-medium text-white">Grid</span>
</div>
<div className="relative isolate flex h-44 items-end overflow-hidden rounded-xl bg-[var(--surface-0)] p-3">
<GridPattern fade="radial" strokeDasharray="4 2" width={32} height={32} />
<span className="relative z-10 rounded-full bg-black/70 px-2.5 py-1 text-xs font-medium text-white">Dashed</span>
</div>
<div className="relative isolate flex h-44 items-end overflow-hidden rounded-xl bg-[var(--surface-0)] p-3">
<GridPattern variant="stripes" width={12} height={12} fade="bottom" />
<span className="relative z-10 rounded-full bg-black/70 px-2.5 py-1 text-xs font-medium text-white">Stripes</span>
</div>
</div>
)
}

Behind a dashboard header

A faded grid gives dashboard headers structure without competing with the data.

Production, last 24 hours

API overview

Requests
2.41M
+8.2% vs yesterday
p95 latency
184 ms
-12 ms vs yesterday
Error rate
0.03%
-0.01% vs yesterday
import { GridPattern, Button, Heading, Text } from "@glinui/ui"
const stats = [
["Requests", "2.41M", "+8.2%"],
["p95 latency", "184 ms", "-12 ms"],
["Error rate", "0.03%", "-0.01%"]
]
export function UsageHeader() {
return (
<section data-glin-theme="dark" className="relative isolate flex min-h-[22rem] w-full flex-col justify-end gap-6 overflow-hidden rounded-xl bg-[var(--surface-0)] p-6 sm:p-8">
<GridPattern fade="radial" squares={[[4, 4], [5, 1], [8, 2], [10, 5], [2, 2]]} />
<div className="relative z-10 flex flex-wrap items-end justify-between gap-4">
<div className="flex flex-col gap-1">
<Text variant="eyebrow">Production, last 24 hours</Text>
<Heading level={2} size="md">API overview</Heading>
</div>
<div className="flex gap-2">
<Button size="sm" variant="outline">Export CSV</Button>
<Button size="sm">Create alert</Button>
</div>
</div>
<dl className="relative z-10 grid gap-3 sm:grid-cols-3">
{stats.map(([label, value, delta]) => (
<div key={label} className="rounded-xl border border-[var(--line-soft)] bg-[var(--surface-1)] p-4">
<dt className="text-xs text-[var(--color-muted)]">{label}</dt>
<dd className="mt-1 text-2xl font-semibold tabular-nums text-[var(--color-foreground)]">{value}</dd>
<dd className="text-xs text-[var(--tone-success-text)]">{delta} vs yesterday</dd>
</div>
))}
</dl>
</section>
)
}

Interactive

Hover cells to light them up. CSS only.

<GridPattern interactive width={32} height={32} />

Accessibility

  • Decorative: aria-hidden, not focusable, pointer-events none (interactive cells opt back in).
  • Hover highlighting is a visual flourish only and has no keyboard equivalent by design.
  • Keep line contrast low behind text.

ARIA Attributes

  • `aria-hidden="true"` and `focusable="false"` on the svg

Reduced Motion

Highlighted squares pulse at motion level full. With reduced motion or level none or subtle the squares are static, and hover cell transitions are removed.

Affected properties

opacityfill

API Reference

PropTypeRequiredDefaultDescription
variant"grid" | "stripes"NogridSquare grid lines or diagonal stripes.
fade"none" | "radial" | "top" | "bottom"NononeEdge fade built with CSS masks.
width / heightnumber-40Cell size in px.
x / ynumber--1Pattern offset.
strokeDasharraystringNo0Dashed lines, for example "4 2".
squaresGridPatternSquare[]No-Highlighted cells as [column, row].
squareColorstringNovar(--color-accent)Highlight and hover color.
interactivebooleanNofalseCells light up on hover.
heightnumberNo40Cell height in px.
widthnumberNo40Cell width in px.
xnumberNo-1Auto-generated from TypeScript source.
ynumberNo-1Auto-generated from TypeScript source.

Source

Import directly from the package or browse the source on GitHub. Click any file to view it.

Import

import { GridPattern } from "@glinui/ui"

Dependencies

@glinui/ui@glinui/motionclass-variance-authority

Generated API Snapshot

Beta

Auto-extracted from TypeScript source in packages/ui/src/components/grid-pattern.tsx. This section is in beta and may lag behind hand-curated docs. Regenerate with pnpm --filter @glinui/docs api:generate.

Generated: 2026-10-08T01:41:21.546Z · Full index: /docs/api-metadata

Primary Props Type

GridPatternProps

GridPatternProps

PropTypeRequiredDefaultDescription
fade"none" | "radial" | "top" | "bottom"No"none"Variant option from gridPatternVariants.
heightnumberNo40Cell height in px.
interactivebooleanNofalseCells light up on hover (CSS only). Content above the pattern will block pointer events.
squareColorstringNo"var(--color-accent)"Fill of highlighted and hovered cells. Defaults to the accent token.
squaresGridPatternSquare[]No-Highlighted cells as [column, row] pairs.
strokeDasharraystringNo"0"-
variant"grid" | "stripes"No"grid"Variant option from gridPatternVariants.
widthnumberNo40Cell width in px.
xnumberNo-1-
ynumberNo-1-