How to use 2D html in xr scene, example WebXRDomOverlay?

if WebXRDomOverlay can, how to use WebXRDomOverlay?
like react-three demo: Mixing HTML and WebGL w/ occlusion - CodeSandbox
thanks guys
I hope your reply


1 Like

thank you so much, i try it

1 Like

I also have a React example up - you can find the source here:
xr-dom-overlay-react/App.tsx at main · brianzinn/xr-dom-overlay-react (

live demo here:
React App (

it’s kind of a quick demo written to prove out the feature before it was added to babylon.js proper, so it should probably check capabilities of device and some other nice things.

Hope that helps. Cheers.

1 Like

it looks like in AR, can it be used in VR?

I thought it was immersive AR only, but the explainer notes ( WebXR DOM Overlays Module ( say:

NOTE: Implementation choices include a fullscreen overlay on a handheld AR device, or a floating rectangle in space for a VR or AR headset.

I think that may be different from 14 months ago as I thought it was AR-only then and that may be also why @RaananW suggested AR-only, but I have not tried in VR. Can you let us know if you get it working on a VR device - I believe we would need to update our docs accordingly from the link that Raanan provided.

1 Like

Hello @alan72320492 just checking in if you’d like any more help?