File: HTMLMesh.md | Updated: 11/15/2025
This class can be used to render a DOM element onto a canvas and use it as a texture for a plane mesh.
A typical use case for this class is to render the GUI of lil-gui as a texture so it is compatible for VR.
const gui = new GUI( { width: 300 } ); // create lil-gui instance
const mesh = new HTMLMesh( gui.domElement );
scene.add( mesh );
HTMLMesh is an addon, and must be imported explicitly, see Installation#Addons.
import { HTMLMesh } from 'three/addons/interactive/HTMLMesh.js';
Constructs a new HTML mesh.
dom | The DOM element to display as a plane mesh.
---|---
Frees the GPU-related resources allocated by this instance and removes all event listeners. Call this method whenever this instance is no longer used in your app.