Shape scene
3DA tactile 3D composition made from Cojeev shapes, with a static fallback and motion preferences built in.
Try it
Add to your project
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/shape-scene.jsonThe command includes the component’s shared dependencies. Your project keeps editable source files.
Include the complete example
This example also composes button. Install its parts together:
npx shadcn@latest add https://luv-jeri.github.io/cojeev-ui/r/shape-scene.json https://luv-jeri.github.io/cojeev-ui/r/button.jsonUsing shape scene
Place the sculpture beside generous typography. Its reserved aspect ratio keeps the surrounding layout stable while it loads.
Choose from sixteen authored shapes and clay, glazed, grain or ripple shader materials. The default palette follows AppearanceProvider; explicit warm/cool palettes are also available.
This optional entry installs Three.js; the rest of the library does not require it. Initialization waits until the scene enters the viewport.
Procedural object-space grain and flowing contour shaders use the existing lighting pass. Offscreen and hidden scenes pause; palette changes recolour meshes without rebuilding the context.
API
Compose the exported parts below. The prop types are read from the React source during the registry build.
Native element or underlying primitive props are inherited where declared, including accessible labels, event handlers and refs.
ShapeSceneProps
| Prop | Type | Required |
|---|---|---|
palette | "cojeev" | "warm" | "cool" | No |
shapes | readonly SceneShape[] | No |
density | "sparse" | "balanced" | "full" | No |
interactive | boolean | No |
animate | boolean | No |
materialTactile procedural surfaces, including an animated ripple shader. | SculptureMaterial | No |
Accessibility
Provide a useful aria-label when the artwork conveys meaning, or aria-hidden for a decorative composition.
Global Off and reduced motion stop ambient and pointer motion. Offscreen and hidden scenes pause work.
Without WebGL2 the authored static shapes remain visible, with a clear fallback description.
States and appearance
For conditional content, keep a MotionPresence boundary around keyed MotionSurface children. The shared entrance and exit states work with native primitives and respect your motion preference.
Try pointer and keyboard interaction, and switch the appearance control in the navigation to compare light and dark mode. Motion respects reduced motion preferences.