New to Claude Skills? Learn how to install them →

vercel-labs on GitHub

React Three Fiber

OfficialFree

Effortlessly render 3D scenes from JSON specs.

Get this skill

Free · Opens the source repo

What React Three Fiber does

React Three Fiber is a powerful renderer designed for use with the json-render library, specifically tailored for building 3D scenes from JSON specifications. It provides a set of 19 built-in 3D components, allowing developers to create complex visual environments with relative ease. By integrating seamlessly with @json-render/react-three-fiber, it enables the rendering of meshes, lights, models, and environments, making it a versatile tool for both developers and designers working with 3D graphics in React applications.

The skill features two main entry points: @json-render/react-three-fiber/catalog for defining catalog schemas without a React Three Fiber dependency, making it safe for server-side use, and @json-render/react-three-fiber which includes the actual 3D components and renderer. This structure allows for a clear separation between component definitions and their implementations, streamlining the development process.

Developers can easily pick and define the 3D components they need using the provided schemas, and then render them within a ThreeCanvas or a manual canvas setup. The skill supports a variety of 3D primitives such as boxes, spheres, and lights, as well as advanced features like environment maps and fog effects, all of which can be customized through props. This flexibility makes it suitable for creating interactive and visually rich applications.

Whether you're building a simple 3D model viewer or a complex interactive scene, React Three Fiber provides the necessary tools and components to bring your ideas to life, making it an essential skill for anyone working in the realm of 3D web development.

When to use it

Use this skill when you need to create and render 3D graphics in a React application, particularly when working with JSON-based scene definitions.

When not to use it

This skill may not be suitable for projects that require extensive custom 3D rendering beyond the provided components or for those not using React.

What you can build with it

Building a 3D Model Viewer

Use React Three Fiber to create an interactive 3D model viewer that loads models from JSON specifications.

Creating Interactive 3D Environments

Develop immersive 3D environments with various lighting and material properties using the built-in components.

Integrating 3D Graphics into Web Applications

Easily integrate 3D graphics into existing React applications by leveraging the json-render capabilities.

How to install React Three Fiber

View source

1. Install with the skills CLI

npx skills add vercel-labs/json-render/react-three-fiber --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by vercel-labs

@json-render/react-three-fiber

React Three Fiber renderer for json-render. 19 built-in 3D components.

Two Entry Points

Entry PointExportsUse For
@json-render/react-three-fiber/catalogthreeComponentDefinitionsCatalog schemas (no R3F dependency, safe for server)
@json-render/react-three-fiberthreeComponents, ThreeRenderer, ThreeCanvas, schemasR3F implementations and renderer

Usage Pattern

Pick the 3D components you need from the standard definitions:

import { defineCatalog } from "@json-render/core";
import { schema } from "@json-render/react/schema";
import { threeComponentDefinitions } from "@json-render/react-three-fiber/catalog";
import { defineRegistry } from "@json-render/react";
import { threeComponents, ThreeCanvas } from "@json-render/react-three-fiber";

// Catalog: pick definitions
const catalog = defineCatalog(schema, {
  components: {
    Box: threeComponentDefinitions.Box,
    Sphere: threeComponentDefinitions.Sphere,
    AmbientLight: threeComponentDefinitions.AmbientLight,
    DirectionalLight: threeComponentDefinitions.DirectionalLight,
    OrbitControls: threeComponentDefinitions.OrbitControls,
  },
  actions: {},
});

// Registry: pick matching implementations
const { registry } = defineRegistry(catalog, {
  components: {
    Box: threeComponents.Box,
    Sphere: threeComponents.Sphere,
    AmbientLight: threeComponents.AmbientLight,
    DirectionalLight: threeComponents.DirectionalLight,
    OrbitControls: threeComponents.OrbitControls,
  },
});

Rendering

ThreeCanvas (convenience wrapper)

<ThreeCanvas
  spec={spec}
  registry={registry}
  shadows
  camera={{ position: [5, 5, 5], fov: 50 }}
  style={{ width: "100%", height: "100vh" }}
/>

Manual Canvas setup

import { Canvas } from "@react-three/fiber";
import { ThreeRenderer } from "@json-render/react-three-fiber";

<Canvas shadows>
  <ThreeRenderer spec={spec} registry={registry}>
    {/* Additional R3F elements */}
  </ThreeRenderer>
</Canvas>

Available Components (19)

Primitives (7)

  • Box -- width, height, depth, material
  • Sphere -- radius, widthSegments, heightSegments, material
  • Cylinder -- radiusTop, radiusBottom, height, material
  • Cone -- radius, height, material
  • Torus -- radius, tube, material
  • Plane -- width, height, material
  • Capsule -- radius, length, material

All primitives share: position, rotation, scale, castShadow, receiveShadow, material.

Lights (4)

  • AmbientLight -- color, intensity
  • DirectionalLight -- position, color, intensity, castShadow
  • PointLight -- position, color, intensity, distance, decay
  • SpotLight -- position, color, intensity, angle, penumbra

Other (8)

  • Group -- container with position/rotation/scale, supports children
  • Model -- GLTF/GLB loader via url prop
  • Environment -- HDRI environment map (preset, background, blur, intensity)
  • Fog -- linear fog (color, near, far)
  • GridHelper -- reference grid (size, divisions, color)
  • Text3D -- SDF text (text, fontSize, color, anchorX, anchorY)
  • PerspectiveCamera -- camera (position, fov, near, far, makeDefault)
  • OrbitControls -- orbit controls (enableDamping, enableZoom, autoRotate)

Shared Schemas

Reusable Zod schemas for custom 3D catalog definitions:

import { vector3Schema, materialSchema, transformProps, shadowProps } from "@json-render/react-three-fiber";
import { z } from "zod";

// Custom 3D component
const myComponentDef = {
  props: z.object({
    ...transformProps,
    ...shadowProps,
    material: materialSchema.nullable(),
    myCustomProp: z.string(),
  }),
  description: "My custom 3D component",
};

Material Schema

materialSchema = z.object({
  color: z.string().nullable(),         // default "#ffffff"
  metalness: z.number().nullable(),     // default 0
  roughness: z.number().nullable(),     // default 1
  emissive: z.string().nullable(),      // default "#000000"
  emissiveIntensity: z.number().nullable(), // default 1
  opacity: z.number().nullable(),       // default 1
  transparent: z.boolean().nullable(),  // default false
  wireframe: z.boolean().nullable(),    // default false
});

Spec Format

3D specs use the standard json-render flat element format:

{
  "root": "scene",
  "elements": {
    "scene": {
      "type": "Group",
      "props": { "position": [0, 0, 0] },
      "children": ["light", "box"]
    },
    "light": {
      "type": "AmbientLight",
      "props": { "intensity": 0.5 },
      "children": []
    },
    "box": {
      "type": "Box",
      "props": {
        "position": [0, 0.5, 0],
        "material": { "color": "#4488ff", "metalness": 0.3, "roughness": 0.7 }
      },
      "children": []
    }
  }
}

Dependencies

Peer dependencies required:

  • @react-three/fiber >= 8.0.0
  • @react-three/drei >= 9.0.0
  • three >= 0.160.0
  • react ^19.0.0
  • zod ^4.0.0

Frequently asked questions about React Three Fiber

Similar skills