Noise Texture
magicui/noise-textureFreeComponent
An SVG fractal noise layer using feTurbulence, desaturation, and contrast controls for subtle texture overlays.
Live preview
live · rendered by the registry
Rendered by magicui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://magicui.design/r/noise-texture.jsonSource
1"use client"23import { useId, type ComponentProps } from "react"45import { cn } from "@/lib/utils"67export interface NoiseTextureProps extends ComponentProps<"svg"> {8 /** Extra classes merged onto the root `svg` element. */9 className?: string10 /**11 * `baseFrequency` for `feTurbulence`; higher values yield finer-grained noise.12 * @default 0.413 */14 frequency?: number15 /**16 * `numOctaves` for `feTurbulence`; more octaves add detail at smaller scales.17 * @default 618 */19 octaves?: number20 /**21 * Linear slope on each channel after desaturation; adjusts contrast of the noise.22 * @default 0.1523 */24 slope?: number25 /**26 * Opacity of the filled noise layer (`rect`).27 * @default 0.628 */29 noiseOpacity?: number30}3132export const NoiseTexture = ({33 className,34 frequency = 0.4,35 octaves = 6,36 slope = 0.15,37 noiseOpacity = 0.6,38 ...props39}: NoiseTextureProps) => {40 const filterId = useId()4142 return (43 <svg44 className={cn(45 "pointer-events-none absolute inset-0 z-0 size-full opacity-50 select-none dark:opacity-[0.75]",46 className47 )}48 xmlns="http://www.w3.org/2000/svg"49 {...props}50 >51 <filter id={filterId}>52 <feTurbulence53 type="fractalNoise"54 baseFrequency={frequency}55 numOctaves={octaves}56 stitchTiles="stitch"57 />58 <feColorMatrix type="saturate" values="0" />59 <feComponentTransfer>60 <feFuncR type="linear" slope={slope} />61 <feFuncG type="linear" slope={slope} />62 <feFuncB type="linear" slope={slope} />63 </feComponentTransfer>64 </filter>65 <rect66 width="100%"67 height="100%"68 filter={`url(#${filterId})`}69 opacity={noiseOpacity}70 />71 </svg>72 )73}
Files it writes
More from magicui
All 247 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Androidandroid | magicui | Components | Free | no deps | |
| Animated Beamanimated-beam | magicui | Components | Free | 1 dep | |
| Animated Circular Progress Baranimated-circular-progress-bar | magicui | Components | Free | no deps | |
| Animated Gradient Textanimated-gradient-text | magicui | Components | Free | no deps | |
| Animated Grid Patternanimated-grid-pattern | magicui | Components | Free | 1 dep | |
| Animated Listanimated-list | magicui | Components | Free | 1 dep | |
| Animated Shiny Textanimated-shiny-text | magicui | Components | Free | no deps | |
| Theme Toggleranimated-theme-toggler | magicui | Components | Free | 1 dep |
