Texture Overlay

A texture overlay component with various CSS gradient patterns (dots, grid, noise, crosshatch, diagonal, halftone, and more) for adding visual texture to backgrounds.

Installation

pnpm dlx shadcn@latest add "https://vritti.thesatyajit.com/r/texture-overlay"

Examples

All Textures

import { TextureOverlay } from "@/components/vritti/texture-overlay"
import type { TextureType } from "@/components/vritti/texture-overlay"

const allTextures: TextureType[] = [
  "dots", "grid", "noise", "crosshatch", "diagonal", "scatteredDots",
  "halftone", "triangular", "chevron", "paperGrain", "horizontalLines", "verticalLines"
]

export function TextureOverlayAllExample() {
  return (
    <div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3 p-8">
      {allTextures.map((texture) => (
        <div key={texture} className="relative h-24 rounded-lg bg-muted dark:bg-neutral-800 overflow-hidden">
          <TextureOverlay texture={texture} />
          <div className="absolute inset-0 flex items-end p-2">
            <span className="text-[10px] font-medium text-foreground/70">{texture}</span>
          </div>
        </div>
      ))}
    </div>
  )
}