Skip to content

Commit f6d1c51

Browse files
authored
react-three-fiber (#209)
1 parent 316439f commit f6d1c51

39 files changed

+9447
-45
lines changed

.changeset/config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"@json-render/image",
2121
"@json-render/mcp",
2222
"@json-render/svelte",
23-
"@json-render/solid"
23+
"@json-render/solid",
24+
"@json-render/react-three-fiber"
2425
]
2526
],
2627
"linked": [],

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ function Dashboard({ spec }) {
121121
| `@json-render/svelte` | Svelte 5 renderer with runes-based reactivity |
122122
| `@json-render/solid` | SolidJS renderer with fine-grained reactive contexts |
123123
| `@json-render/shadcn` | 36 pre-built shadcn/ui components (Radix UI + Tailwind CSS) |
124+
| `@json-render/react-three-fiber` | React Three Fiber renderer for 3D scenes (19 built-in components) |
124125
| `@json-render/react-native` | React Native renderer with standard mobile components |
125126
| `@json-render/remotion` | Remotion video renderer, timeline schema |
126127
| `@json-render/react-pdf` | React PDF renderer for generating PDF documents from specs |
@@ -434,6 +435,47 @@ import { renderToSvg } from "@json-render/image/render";
434435
const svg = await renderToSvg(spec, { fonts });
435436
```
436437

438+
### Three.js (3D)
439+
440+
```tsx
441+
import { defineCatalog } from "@json-render/core";
442+
import { schema, defineRegistry } from "@json-render/react";
443+
import {
444+
threeComponentDefinitions,
445+
threeComponents,
446+
ThreeCanvas,
447+
} from "@json-render/react-three-fiber";
448+
449+
const catalog = defineCatalog(schema, {
450+
components: {
451+
Box: threeComponentDefinitions.Box,
452+
Sphere: threeComponentDefinitions.Sphere,
453+
AmbientLight: threeComponentDefinitions.AmbientLight,
454+
DirectionalLight: threeComponentDefinitions.DirectionalLight,
455+
OrbitControls: threeComponentDefinitions.OrbitControls,
456+
},
457+
actions: {},
458+
});
459+
460+
const { registry } = defineRegistry(catalog, {
461+
components: {
462+
Box: threeComponents.Box,
463+
Sphere: threeComponents.Sphere,
464+
AmbientLight: threeComponents.AmbientLight,
465+
DirectionalLight: threeComponents.DirectionalLight,
466+
OrbitControls: threeComponents.OrbitControls,
467+
},
468+
});
469+
470+
<ThreeCanvas
471+
spec={spec}
472+
registry={registry}
473+
shadows
474+
camera={{ position: [5, 5, 5], fov: 50 }}
475+
style={{ width: "100%", height: "100vh" }}
476+
/>;
477+
```
478+
437479
## Features
438480

439481
### Streaming (SpecStream)

0 commit comments

Comments
 (0)