ShaderMount from @paper-design/shaders-react is the React wrapper around the vanilla ShaderMount class. It renders a <div> and manages a ShaderMount instance as a side effect, keeping it in sync with React props.
This component is marked
'use client'. In Next.js App Router projects, import it inside a Client Component or add 'use client' at the top of the file that uses it.ShaderMountProps
The GLSL fragment shader source code (WebGL 2). This prop is used to initialize the underlying
ShaderMount instance. Changing it destroys and recreates the shader.An object of uniform values. In addition to all the types supported by the vanilla
ShaderMountUniforms, the React version also accepts strings, which are treated as image URLs and loaded asynchronously as HTMLImageElements.An empty string '' is replaced with a transparent 1×1 pixel placeholder so the shader stays valid while waiting for a real image.Animation speed multiplier.
0 = static, negative = reverse. Changes to this prop call setSpeed() on the underlying instance.Frame offset in milliseconds. Changes to this prop call
setFrame().Minimum device pixel ratio to render at. Defaults to
2 in the underlying class. Changes call setMinPixelRatio().Maximum physical pixel cap. Defaults to
1920 × 1080 × 4 in the underlying class. Changes call setMaxPixelCount().Names of texture uniforms that should have mipmaps generated. Passed to the
ShaderMount constructor on initialization.Optional WebGL context attributes passed to
canvas.getContext('webgl2', ...). Captured on mount and not reactive — changes after mount have no effect.Convenience prop for the
style.width of the container <div>. Numeric values are used as-is (treated as pixels). Equivalent to setting style={{ width: ... }}.Convenience prop for the
style.height of the container <div>. Numeric values are used as-is (treated as pixels).A ref forwarded to the container
<div>. The element is typed as PaperShaderElement, so you can access element.paperShaderMount to reach the underlying ShaderMount instance.<div> props (className, style, onClick, etc.) are also accepted and spread onto the container element. The color prop is omitted to avoid conflicts.
ShaderComponentProps
The prop type shared by all built-in React shader components. It isShaderMountProps minus fragmentShader and uniforms (those are provided internally by each component).
ShaderComponentProps with its own shader-specific params: