Layout & Positioning
The <Shader> component renders a <canvas> element — a standard HTML block element with no intrinsic size. You control its dimensions and position entirely through CSS, the same way you would any other element. Understanding this model unlocks the full range of creative possibilities.
The canvas model
Every <Shader> renders exactly one <canvas>. It doesn't matter how many components you include in the shader, it will be one canvas, with one shader running.
Sizing the canvas
Apply classes or styles directly to the <Shader> component:
Common layout patterns
Full-page background
A shader that stays fixed behind all page content, covering the entire viewport:
Section background
A shader that fills a content section without affecting the rest of the page. The parent must have position: relative and overflow: hidden to contain the canvas:
Card with shader fill
A shader used as the visual background of a card or panel:
Inline content block
A shader that flows naturally in document layout, like an image or video:
Layering content over shaders
Pointer events
Canvases capture all pointer events by default. Add pointer-events: none when the shader is decorative and you want clicks and hovers to reach content underneath:
Interactive effects like CursorTrail and CursorRipples still track global mouse position even with pointer-events: none — they listen on the window rather than the canvas element.
Stacking context and z-index
z-index only works on positioned elements. Ensure any content you want above the canvas has position: relative (or similar) and a higher z-index:
<div class="relative">
<!-- canvas at z-0 -->
<canvas class="absolute inset-0"></canvas>
<!-- content above canvas -->
<div class="relative z-10">I appear above the canvas</div>
</div>
Responsive sizing
Shaders responds to any CSS-based resize:
Other CSS properties
The canvas element is fully styleable with standard CSS: