UIPin
ComponentsIconsIllustrationsMotionTemplatesApps
Boards
UIPin

Free, open-source UI components, icons, illustrations, motion, templates and apps, in one search. Every item links to its source and licence.

UIPin is free. If it saved you time, you can keep it running:

Buy me a coffee
ComponentsIconsIllustrationsMotionTemplatesAppsLibrariesCompareNew this weekMCP for agentsBoardsPrivacy

Components, icons and artwork belong to their authors and are shown under their open-source licences.

Cult UI/Bg Image Texture

Text effects
1 of 3
Compiling

Theme it

Every preview, live

Brand colour

Corner radius

Font

Recolours shadcn’s tokens, Tailwind’s accent colours and colours set in the code. Red, amber and green classes stay, since they usually mean error, warning or success.

3 versions·1 library

  • Bg Image Texture
  • Texture Button
  • Texture Card

Bg Image Texture

Background texture component with multiple texture variants and customizable opacity

npx shadcn@latest add https://cult-ui.com/r/bg-image-texture.json
Open in v0 Docs Repo
Library
Cult UI
License
MIT
Stack
React · Tailwind CSS · radix
Packages
cnradix-ui
Also adds
button, card, label, slider
Size
53 lines
Demo
From Cult UI

Code

registry/default/ui/bg-image-texture.tsx

import type React from "react"

import { cn } from "@/lib/utils"

export type TextureVariant =
  | "fabric-of-squares"
  | "grid-noise"
  | "inflicted"
  | "debut-light"
  | "groovepaper"
  | "none"

interface BackgroundImageTextureProps {
  variant?: TextureVariant
  opacity?: number
  className?: string
  children?: React.ReactNode
}

const textureMap: Record<Exclude<TextureVariant, "none">, string> = {
  "fabric-of-squares": "/textures/fabric-of-squares.png",
  "grid-noise": "/textures/grid-noise.png",
  inflicted: "/textures/inflicted.png",
  "debut-light": "/textures/debut-light.png",
  groovepaper: "/textures/groovepaper.png",
}

export function BackgroundImageTexture({
  variant = "fabric-of-squares",
  opacity = 0.5,
  className,
  children,
}: BackgroundImageTextureProps) {
  const textureUrl = variant !== "none" ? textureMap[variant] : null

  return (
    <div className={cn("relative", className)}>
      {textureUrl && (
        <div
          aria-hidden="true"
          className="pointer-events-none absolute inset-0"
          style={{
            backgroundImage: `url(${textureUrl})`,
            backgroundRepeat: "repeat",
            opacity,
          }}
        />
      )}
      {children && <div className="relative">{children}</div>}
    </div>
  )
}

More like this

Label

HextaUI·Inputs & forms

Progress

HextaUI·Feedback & loaders

Collapsible

HextaUI·Data display

Feature Carousel

Cult UI·Cards

Context menu

HextaUI·Text effects

Bento Grid

Magic UI·Cards

Resizable

HextaUI·Data display

Vote Tally

Cult UI·Data display

Loading Carousel

Cult UI·Feedback & loaders

Safari

Magic UI·Media & 3D

Popover

Cult UI·Overlays

Textarea

shadcn/ui·Text effects

Transition Panel

Motion Primitives·Other

Side Panel

Cult UI·Other

Hero Video Dialog

Magic UI·Inputs & forms