bg-image-texture
cult-ui/bg-image-textureUnverifiedComponent
Background texture component with multiple texture variants and customizable opacity
Install it
npx shadcn@latest add https://raw.githubusercontent.com/nolly-studio/cult-ui/HEAD/apps/www/bg-image-texture.jsonSource
1import type React from "react"23import { cn } from "@/lib/utils"45export type TextureVariant =6 | "fabric-of-squares"7 | "grid-noise"8 | "inflicted"9 | "debut-light"10 | "groovepaper"11 | "none"1213interface BackgroundImageTextureProps {14 variant?: TextureVariant15 opacity?: number16 className?: string17 children?: React.ReactNode18}1920const textureMap: Record<Exclude<TextureVariant, "none">, string> = {21 "fabric-of-squares": "/textures/fabric-of-squares.png",22 "grid-noise": "/textures/grid-noise.png",23 inflicted: "/textures/inflicted.png",24 "debut-light": "/textures/debut-light.png",25 groovepaper: "/textures/groovepaper.png",26}2728export function BackgroundImageTexture({29 variant = "fabric-of-squares",30 opacity = 0.5,31 className,32 children,33}: BackgroundImageTextureProps) {34 const textureUrl = variant !== "none" ? textureMap[variant] : null3536 return (37 <div className={cn("relative", className)}>38 {textureUrl && (39 <div40 aria-hidden="true"41 className="pointer-events-none absolute inset-0"42 style={{43 backgroundImage: `url(${textureUrl})`,44 backgroundRepeat: "repeat",45 opacity,46 }}47 />48 )}49 {children && <div className="relative">{children}</div>}50 </div>51 )52}
Files it writes
More from cult/ui
All 157 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| ai-instructionsai-instructions | cult/ui | Components | Unverified | 2 deps | |
| ai-instructions-demoai-instructions-demo | cult/ui | Components | Unverified | no deps | |
| animated-numberanimated-number | cult/ui | Components | Unverified | 1 dep | |
| animated-number-demoanimated-number-demo | cult/ui | Components | Unverified | no deps | |
| bg-animate-buttonbg-animate-button | cult/ui | Components | Unverified | no deps | |
| bg-animate-button-demobg-animate-button-demo | cult/ui | Components | Unverified | no deps | |
| bg-animated-fractal-dot-gridbg-animated-fractal-dot-grid | cult/ui | Components | Unverified | 1 dep | |
| bg-animated-fractal-dot-grid-demobg-animated-fractal-dot-grid-demo | cult/ui | Components | Unverified | no deps |
