Tooluck logoTooluck
SKILL.md

threejs-react-three-fiber

Agent skill fromCloudAI-X/threejs-skills

Building three.js scenes from React with React Three Fiber and drei: renderer setup, the scene graph as JSX, frame-loop, state and loading hooks, pointer events, and adaptive performance, on WebGL or with WebGPU and TSL. Use when writing React components that render three.js.

How to install threejs-react-three-fiber

install threejs-react-three-fiber
# install the threejs-skills pack with the skills CLI
npx skills add CloudAI-X/threejs-skills

# or add only this skill to Claude Code: copy the folder

skills/threejs-react-three-fiber/

# into

~/.claude/skills/threejs-react-three-fiber/ (all projects)

.claude/skills/threejs-react-three-fiber/ (one project)

skills/threejs-react-three-fiber/SKILL.md

MITFull file
1# Three.js React Three Fiber
2
3Targets three.js r186. Examples use WebGLRenderer; the WebGPU and TSL section uses WebGPURenderer.
4
5## Quick Start
6
7Targets `@react-three/fiber` 9.8 with React 19 and `@react-three/drei` 10.7. The Canvas creates and owns a WebGLRenderer, a scene and a camera; three.js objects become JSX elements. The Canvas fills its parent element, so give the parent a height. The component fragments below render inside a Canvas like this one; lit materials assume its lights.
8
9```jsx
10import { useRef } from "react";
11import { Canvas, useFrame } from "@react-three/fiber";
12import { OrbitControls } from "@react-three/drei";
13
14function Box() {
15 const ref = useRef();
16 useFrame((_, delta) => {
17 ref.current.rotation.y += delta;
18 });
19 return (
20 <mesh ref={ref} position={[0, 0.5, 0]} castShadow>
21 <boxGeometry args={[1, 1, 1]} />
22 <meshStandardMaterial color="#d9915b" />
23 </mesh>
24 );
25}
26
27export default function App() {
28 return (
29 <Canvas shadows="percentage" camera={{ position: [3, 2, 4], fov: 50 }}>
30 <color attach="background" args={["#111827"]} />
31 <ambientLight intensity={0.4} />
32 <directionalLight position={[3, 4, 2]} intensity={2} castShadow />
33 <Box />
34 <mesh rotation-x={-Math.PI / 2} receiveShadow>
35 <planeGeometry args={[10, 10]} />
36 <meshStandardMaterial color="#20293a" />
37 </mesh>
38 <OrbitControls makeDefault />
39 </Canvas>
40 );
41}
42```
43
44## Canvas Props
45
46```jsx
47export function App() {
48…

Excerpt shown under the repository's MIT license.

More skills in threejs-skills

Keep exploring

Similar skill repositories

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates