API Reference
@json-render/react-three-fiber Copy for LLM View Markdown React Three Fiber renderer for json-render. 20 built-in 3D components for meshes, lights, models, gaussian splats, environments, text, cameras, and controls.
npm install @json-render/react-three-fiber @json-render/core @json-render/react @react-three/fiber @react-three/drei three zod
Entry Point Exports Use For @json-render/react-three-fiberthreeComponents, ThreeRenderer, ThreeCanvas, schemasReact Three Fiber implementations and renderer @json-render/react-three-fiber/catalogthreeComponentDefinitionsCatalog schemas (no R3F dependency, safe for server)
import { '{ defineCatalog }' } from " @json-render/core " ;
import { '{ schema, defineRegistry }' } from " @json-render/react " ;
import { '{' }
threeComponentDefinitions ,
threeComponents ,
ThreeCanvas ,
{ '}' } from " @json-render/react-three-fiber " ;
const catalog = defineCatalog (schema , { ' { ' }
components: { ' { ' }
Box: threeComponentDefinitions . Box ,
Sphere: threeComponentDefinitions . Sphere ,
AmbientLight: threeComponentDefinitions . AmbientLight ,
DirectionalLight: threeComponentDefinitions . DirectionalLight ,
OrbitControls: threeComponentDefinitions . OrbitControls ,
{ ' } ' },
actions: { ' {} ' },
{ ' } ' } ) ;
const { ' { registry } ' } = defineRegistry (catalog , { ' { ' }
components: { ' { ' }
Box: threeComponents . Box ,
Sphere: threeComponents . Sphere ,
AmbientLight: threeComponents . AmbientLight ,
DirectionalLight: threeComponents . DirectionalLight ,
OrbitControls: threeComponents . OrbitControls ,
{ ' } ' },
{ ' } ' } ) ;
< ThreeCanvas
spec = { ' {spec} ' }
registry = { ' {registry} ' }
shadows
camera = { ' { ' }{ ' { position: [5, 5, 5], fov: 50 } ' }{ ' } ' }
style = { ' { ' }{ ' { width: "100%", height: "100vh" } ' }{ ' } ' }
/>
import { '{ Canvas }' } from " @react-three/fiber " ;
import { '{ ThreeRenderer }' } from " @json-render/react-three-fiber " ;
< Canvas shadows >
< ThreeRenderer spec = { ' {spec} ' } registry = { ' {registry} ' } />
</ Canvas >
Component Description Key Props BoxBox mesh (default 1x1x1) width, height, depth, materialSphereSphere mesh radius, widthSegments, heightSegments, materialCylinderCylinder mesh radiusTop, radiusBottom, height, materialConeCone mesh radius, height, materialTorusTorus (donut) mesh radius, tube, materialPlaneFlat plane mesh width, height, materialCapsuleCapsule mesh radius, length, material
All primitives share: position, rotation, scale, castShadow, receiveShadow, material.
Property Type Default colorstring"#ffffff"metalnessnumber0roughnessnumber1emissivestring"#000000"emissiveIntensitynumber1opacitynumber1transparentbooleanfalsewireframebooleanfalse
Component Description Key Props AmbientLightUniform illumination color, intensityDirectionalLightSunlight-style position, color, intensity, castShadowPointLightRadiates from a point position, color, intensity, distance, decaySpotLightCone of light position, color, intensity, angle, penumbra
Component Description Key Props GroupContainer for children position, rotation, scaleModelGLTF/GLB model loader url, position, rotation, scaleEnvironmentHDRI environment map preset, background, blur, intensityFogLinear fog effect color, near, farGridHelperReference grid size, divisions, colorText3D3D text (SDF) text, fontSize, color, anchorX, anchorYPerspectiveCameraCamera position, fov, near, far, makeDefaultOrbitControlsCamera controls enableDamping, enableZoom, autoRotateGaussianSplatGaussian splat (.splat/.ply) loader src, position, rotation, scale, alphaHash, toneMapped
Reusable Zod schemas for custom 3D components:
import { '{ vector3Schema, materialSchema, transformProps, shadowProps }' } from " @json-render/react-three-fiber " ;
Export Description vector3Schemaz.tuple([z.number(), z.number(), z.number()])materialSchemaStandard material props (color, metalness, roughness, etc.) transformProps{ position, rotation, scale } schema fieldsshadowProps{ castShadow, receiveShadow } schema fields
Prop Type Description specSpec | nullThe spec to render as a 3D scene registryComponentRegistryComponent registry from defineRegistry storeStateStoreExternal state store (controlled mode) initialStateRecord<string, unknown>Initial state (uncontrolled mode) handlersRecord<string, Function>Action handlers loadingbooleanWhether the spec is streaming childrenReactNodeAdditional R3F elements alongside the spec
Extends ThreeRendererProps with Canvas options:
Prop Type Description shadowsbooleanEnable shadow maps cameraobjectDefault camera config (position, fov, etc.) classNamestringCSS class for the canvas container styleCSSPropertiesInline styles for the canvas container
import type { '{ ThreeProps }' } from " @json-render/react-three-fiber " ;
type BoxProps = ThreeProps < " Box " >;
type SphereProps = ThreeProps < " Sphere " >;