Integrations
XR Blocks is designed to be modular and lightweight. Many features are enabled only when specific optional dependencies are installed in your project. This approach allows you to keep your bundle size small by including only the features you need.
Optional Dependencies
The following table lists the optional dependencies supported by XR Blocks and the features they unlock.
| Feature | Dependency | Description |
|---|---|---|
| Physics | @dimforge/rapier3d | Enables physics simulation for 3D objects, including rigid body dynamics, colliders, and gravity. Required for any physics-based interactions. |
| Generative AI (Gemini) | @google/genai | Enables integration with Google's Gemini models, including Multimodal Live API support for real-time audio/video interaction. |
| Generative AI (OpenAI) | openai | Enables integration with OpenAI's models for text generation and chat capabilities. |
| Built-in spatial UI | @pmndrs/uikit, @preact/signals-core | Renders UICard, UIOverlay, and their child components. These are required peer dependencies, not a separate XR Blocks add-on. |
| Simulator browser UI | lit | Registers simulator settings, instructions, hand-pose, and optional Gemini Live panels. The simulator continues without these panels if Lit is absent. |
| Simulator navmesh | three-pathfinding | Constrains the simulated user to an environment navmesh when enabled. |
| Text Rendering | troika-three-text | Provides high-quality, signed-distance-field (SDF) 3D text rendering. Essential for readable and crisp text in 3D space. |
| Gaussian Splatting | @sparkjsdev/spark | Enables viewing of Gaussian Splatting models, allowing for photorealistic scene rendering. |
Installing Integrations
To use any of these features, simply add the corresponding packages and their dependencies to your importmap or install them using npm.
XR Blocks loads these libraries only when the corresponding feature starts. Browser import-map
applications must map every transitive bare specifier used by the selected feature. Copy the
verified mappings from rollup.config.js or the closest current template.
Built-in UI and renderer extensions
@pmndrs/uikit and @preact/signals-core are peer dependencies of the built-in
UI renderer. They are not the application UI API. Ordinary applications import
UICard, UIOverlay, UIPanel, UIText, UIButton, and other semantic
components from xrblocks.
XR Blocks currently has no public low-level adapter for composing directly with
the built-in UIKit backend. Files under src/ui/internal/ and
build/internal/ are private. A specialized addon can expose its own renderer
through an addon public entry, but it must integrate input through supported XR
Blocks interaction surfaces and must not import private built-in UI files.
See Spatial UI for the supported component and extension boundary.