React Truchet Shaders
React Truchet patterns with procedural tiling. Geometric pattern effects for Next.js with TypeScript and shadcn/ui—free code.
Powered by
Building Truchet pattern effects?
Join our Discord community for help from other developers working with procedural patterns and geometric effects.
Need sophisticated Truchet tiling patterns with smooth animation? Most developers use static geometric patterns that can't create the complex, flowing connections of Truchet tiles. This React Truchet component uses GPU procedural generation to create dynamic tiling patterns with rotation, anti-aliasing, and color cycling.
Copy-paste TypeScript component that creates mesmerizing Truchet pattern effects with procedural tile generation, rotation matrices, and checkerboard logic. Mathematical tiling beauty with customizable parameters. Built for Next.js applications with shadcn/ui design system. GPU-accelerated—smooth pattern flow.
React Truchet with procedural tiling
Dynamic geometric patterns with rotation, anti-aliasing, and procedural noise generation:
Based on shader by ftjczG - Truchet tiling patterns
Perfect for React 19, Next.js 15, and modern TypeScript projects. Truchet patterns generated entirely on GPU using procedural noise and geometric mathematics. Customizable speed, scale, complexity, color shifting, and anti-aliasing. Full shadcn/ui compatibility with Tailwind CSS styling.
Installation
npx shadcn@latest add https://www.shadcn.io/registry/truchet-shaders.json
npx shadcn@latest add https://www.shadcn.io/registry/truchet-shaders.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/truchet-shaders.json
bunx shadcn@latest add https://www.shadcn.io/registry/truchet-shaders.json
Usage
import { TruchetShaders } from "@/components/ui/truchet-shaders";
export default function GeometricPatterns() {
return (
<TruchetShaders
speed={0.8}
scale={1.0}
complexity={1.2}
colorShift={1.0}
antiAliasing={1.0}
>
<div className="relative z-10">
<h1>Content over Truchet patterns</h1>
</div>
</TruchetShaders>
);
}
Why Truchet patterns require mathematical precision
Simple tiling approaches create disconnected patterns without flow. Static geometric designs lack the organic connectivity of true Truchet tiles. Most libraries can't handle the complex rotation and scaling needed for dynamic patterns. Traditional methods struggle with the anti-aliasing required for smooth geometric edges.
GPU procedural mathematics solve this with authentic tiling algorithms. Rotation matrices create smooth pattern flow. Checkerboard logic ensures proper tile connectivity. Procedural noise generates infinite pattern variations. Distance-based coloring provides natural shading and depth.
This React Truchet component uses professional geometric mathematics for authentic tiling behavior. Cell-based coordinate systems create perfect tessellation. Sign manipulation controls tile orientation. Anti-aliasing ensures smooth edges at all scales. Color phase cycling creates dynamic visual interest.
React Truchet shader features
- Procedural tile generation - Infinite pattern variations using GPU noise functions
- Rotation matrix animation - Smooth pattern flow with mathematical rotation
- Checkerboard tessellation logic - Proper tile connectivity following Truchet rules
- Anti-aliasing support - Smooth edges with customizable sampling quality
- Distance-based shading - Natural depth and dimension through mathematical gradients
- Cell coordinate system - Perfect geometric tessellation across all scales
- Sign manipulation - Control tile orientation for pattern complexity
- Color phase cycling - Dynamic spectrum transitions with customizable timing
- Scale-independent rendering - Consistent quality from macro to micro views
- Mathematical precision - GPU-accurate geometric calculations for perfect patterns
- Customizable complexity - Control pattern intricacy and connection density
- Speed variation - Animation timing for rotation and color cycling
- TypeScript React component - Full IDE support with prop definitions
- Next.js compatible - Works with App Router and modern React patterns
- shadcn/ui integration - Consistent with Tailwind CSS design systems
- Copy-paste installation - No vendor lock-in, you own the shader code
API Reference
TruchetShaders
Main container component for the Truchet tiling pattern effect.
Prop | Type | Default | Description |
---|---|---|---|
speed | number | 1.0 | Animation speed for rotation and color (0.5 to 2.0) |
scale | number | 1.0 | Pattern scale and tile density (0.5 to 3.0) |
complexity | number | 1.0 | Pattern intricacy and connection density (0.5 to 2.0) |
colorShift | number | 1.0 | Color spectrum cycling rate (0.5 to 2.0) |
antiAliasing | number | 1.0 | Edge smoothing quality (0.0 to 1.0) |
className | string | - | Additional Tailwind CSS classes |
...props | HTMLAttributes<HTMLDivElement> | - | All standard div props |
GPU Truchet troubleshooting
Pattern rotation too slow/fast: Adjust speed
for comfortable viewing. Lower values create meditative pattern flow, higher values create dynamic geometric animation.
Tiles too large/small: Use scale
to control tile density. Higher values create finer patterns, lower values create larger, more visible geometric structures.
Pattern too simple/complex: Modify complexity
for connection density. Higher values create more intricate tile relationships and pattern variations.
Colors cycling too fast/slow: Adjust colorShift
for spectrum transition timing. This controls how quickly colors cycle through the geometric patterns.
Edges too jagged/soft: Use antiAliasing
to control edge smoothing. Higher values create smoother edges but may impact performance on older devices.
Mobile performance: Reduce antiAliasing
to 0.5 and complexity
to 0.8 on older devices. Truchet calculations are well-optimized but benefit from reduced sampling.
Pattern connectivity: The checkerboard logic ensures proper Truchet tile connectivity - disconnected patterns indicate scaling issues.
More React shader components
Explore other GPU-accelerated shader components for Next.js applications:
Noise Shaders
Advanced procedural patterns with hash functions and fractal detail
Kaleidoscope Shaders
Dynamic animated kaleidoscope with multiple rotating layers and wave synthesis
Gradient Mesh Shaders
Dynamic multi-point gradients with organic movement and smooth color transitions
Fractals Shaders
Infinite geometric patterns with IFS algorithms and volumetric rendering
Plasma Shaders
Organic energy effects with flowing plasma patterns and smooth color cycling
Cosmic Discs Shaders
Glowing radial arcs with concentric rings and polar coordinate mathematics
React Truchet patterns FAQ
Truchet Kaleidoscope Shaders
Stunning kaleidoscope effects with advanced Truchet patterns and layered tunneling. Complex geometric transformations creating mesmerizing symmetrical visuals with depth.
React Tunnel Shaders
React tunnel with GPU psychedelic effects. Hypnotic tunnel animations for Next.js with TypeScript and shadcn/ui—free code.