JGuang

Noise Texture

Noise Texture · Magic UI

Preview
npx shadcn@latest add https://jiguang132.com/r/magic-ui/noise-texture.json

Some upstream demos use online images, videos or tweets. That content depends on network access and third-party services.

Noise Texture

Install: npx shadcn@latest add https://jiguang132.com/r/magic-ui/noise-texture.json

Use case

Overlay an SVG turbulence noise texture.

Native props used by the examples

Extracted from all local examples for this entry, grouped by imported module and native owner, including other Magic components used by compound demos. This is not an exhaustive API or a universal host variant. Inspect spread object declarations and the source types/defaults below.

Owning component propExplanationExample source
NoiseTexture.className (noise-texture)Classes on this native component; initialize Tailwind and its required CSS first.examples/noise-texture-demo.tsx、examples/noise-texture-demo-3.tsx
NoiseTexture.noiseOpacity (noise-texture)Opacity of the SVG noise layer.examples/noise-texture-demo-2.tsx、examples/noise-texture-demo-3.tsx、examples/noise-texture-demo-4.tsx

Interaction and state checks

  • Noise Texture Demo — noise-texture-demo
  • Noise Texture Demo (newsletter card) — noise-texture-demo-2
  • Noise Texture Demo (button) — noise-texture-demo-3
  • Noise Texture Demo (input) — noise-texture-demo-4

These names identify real example entries, not new component props or extra components. Check pointer/keyboard behavior, themes, small screens and failures for the selected example. Decorative effects must not invent disabled/error/submission states. Complete example installation includes the actual dependency closure.

Business integration boundary

Tune opacity and filter detail conservatively; noise is decoration, not an image-processing service.

Host and motion setup

Initialize Tailwind CSS v4, semantic CSS variables and the dark variant; import the independent local Registry namespace. Reuse an existing next-themes Provider without substituting JGuang UI/Base UI/HeroUI APIs. Mount effects in view and unmount offscreen; provide static alternatives for unavailable Canvas/WebGL or failed remote media. Respect prefers-reduced-motion and verify timer/RAF/observer/listener cleanup: stopping CSS alone does not prove the engine stopped. Examples provide no backend, login, payment or real AI stream. This practical guide is bilingual; detailed upstream references and demo text retain their original language.

Available examples

noise-texture-demo, noise-texture-demo-2, noise-texture-demo-3, noise-texture-demo-4

Demo state and mock data do not provide a backend service. Inspect the component props before wiring real data.

Installation

<Tabs defaultValue="cli"> <TabsList> <TabsTrigger value="cli">CLI</TabsTrigger> <TabsTrigger value="manual">Manual</TabsTrigger> </TabsList> <TabsContent value="cli">
npx shadcn@latest add @magicui/noise-texture
</TabsContent> <TabsContent value="manual"> <Steps>

<Step>Copy and paste the following code into your project.</Step>

<Step>Update the import paths to match your project setup.</Step>

</Steps> </TabsContent> </Tabs>

Examples

Newsletter digest

Button

Input field

Usage

NoiseTexture renders a full-size svg (absolute, inset 0). Put it inside a relative container and layer content above with z-10 when needed.

import { NoiseTexture } from "@/components/ui/noise-texture"
<div className="relative h-64 overflow-hidden rounded-lg border">
  <NoiseTexture />
</div>

Props

NoiseTextureProps extends React’s ComponentProps<"svg">. Besides standard SVG attributes, these props are supported:

NoiseTexture

PropTypeDefaultDescription
classNamestring—Merged onto the root svg (via cn)
frequencynumber0.4baseFrequency for feTurbulence
octavesnumber6numOctaves for feTurbulence
slopenumber0.15Linear slope per channel after desaturation
noiseOpacitynumber0.6Opacity of the noise rect

Credits

Complete example installation

The component command installs the component. Each example command also includes its actual imported components, native support UI, utilities and pinned dependencies. Helpers are not additional catalog components.

Noise Texture Demo

npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/noise-texture/noise-texture-demo.json

Default import: @/components/magicui/examples/noise-texture-demo

Dependencies: clsx@2.1.1, tailwind-merge@3.6.0

Noise Texture Demo (newsletter card)

npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/noise-texture/noise-texture-demo-2.json

Default import: @/components/magicui/examples/noise-texture-demo-2

Dependencies: @radix-ui/react-label@2.1.11, @radix-ui/react-slot@1.3.0, class-variance-authority@0.7.1, clsx@2.1.1, tailwind-merge@3.6.0

Noise Texture Demo (button)

npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/noise-texture/noise-texture-demo-3.json

Default import: @/components/magicui/examples/noise-texture-demo-3

Dependencies: @radix-ui/react-slot@1.3.0, class-variance-authority@0.7.1, clsx@2.1.1, tailwind-merge@3.6.0

Noise Texture Demo (input)

npx shadcn@latest add https://jiguang132.com/r/magic-ui/examples/noise-texture/noise-texture-demo-4.json

Default import: @/components/magicui/examples/noise-texture-demo-4

Dependencies: @radix-ui/react-label@2.1.11, class-variance-authority@0.7.1, clsx@2.1.1, tailwind-merge@3.6.0

Minimal usage and theme

import Demo from '@/components/magicui/examples/noise-texture-demo';
import { ThemeProvider } from 'next-themes';
export default function Example() {
  return <ThemeProvider attribute="class" defaultTheme="system" enableSystem><Demo /></ThemeProvider>;
}

Initialize Tailwind CSS v4, semantic color variables and the dark variant first. Reuse an existing next-themes provider rather than nesting another. Next Link examples require a Next.js environment; in static Vite projects adapt the demo links to your router without changing the native component API. Some media and tweets require network access. Examples do not supply authentication or backend services.

Source-backed parameter reference

Implementation signatures and types are generated from the pinned local source. Optional props, native inherited types, union branches and never exclusions are preserved. A forwardRef implementation's ref is a React reference, not an additional business prop.

NoiseTexture({
  className,
  frequency = 0.4,
  octaves = 6,
  slope = 0.15,
  noiseOpacity = 0.6,
  ...props
}: NoiseTextureProps)
export interface NoiseTextureProps extends ComponentProps<"svg"> {
  /** Extra classes merged onto the root `svg` element. */
  className?: string
  /**
   * `baseFrequency` for `feTurbulence`; higher values yield finer-grained noise.
   * @default 0.4
   */
  frequency?: number
  /**
   * `numOctaves` for `feTurbulence`; more octaves add detail at smaller scales.
   * @default 6
   */
  octaves?: number
  /**
   * Linear slope on each channel after desaturation; adjusts contrast of the noise.
   * @default 0.15
   */
  slope?: number
  /**
   * Opacity of the filled noise layer (`rect`).
   * @default 0.6
   */
  noiseOpacity?: number
}

Destructuring defaults in source

Only defaults written directly in parameter/props destructuring are listed. Conditional expressions, runtime theme and computed values require source inspection; this is not an exhaustive behavior-default list.

// NoiseTexture
frequency = 0.4

// NoiseTexture
octaves = 6

// NoiseTexture
slope = 0.15

// NoiseTexture
noiseOpacity = 0.6

Native and external types

External types remain defined by React or native dependencies, not manually expanded into guessed props. The installed version's TypeScript definitions are authoritative.

ComponentProps<"svg">