Skip to content

justdomOne interface, on the page and in the headset

A reactive, non-VDOM renderer for the DOM and for Three.js, built on signals.

The Desk demo as a page
On a page: HTML and CSS, wired to signals.
The Desk demo in the emulated headset
In a headset: the same elements, each mirrored into a panel.

Write the interface once

A headset app still needs an interface: a menu, a form, a list, text to read and a field to type into. A browser already does all of that, with layout, fonts and CSS, but a WebXR session draws a Three.js scene, and a scene has none of it. So an app that runs on a page and in a headset usually builds its interface twice, once in HTML and again out of meshes and textures, and then keeps the two in step by hand.

justdom keeps one interface, and it is the DOM. justdom-three mirrors elements the page already has into panels in the scene, drawn from their computed style. A change to the page, a class, an attribute or a line of text, shows in the panel, which re-measures only what that change can move. A ray on a panel sends the page the events a mouse would, so the handlers that run are the page's own.

DOM panels in the guide shows how, and the demos show it in full apps.