Skip to content

createPerformanceStats#element

Summary

createPerformanceStats#element exposes the DOM container for the performance overlay. Use it to apply a CSS class or attach accessibility metadata to the runtime display.

Syntax

readonly PerformanceStats.element: HTMLDivElement
const panel = stats.element;

Returns

HTMLDivElement - The live overlay element, mounted during construction. It contains the text display and, when enabled, the graph canvas. Destroying the stats display removes this element from its parent.

Example

const stats = wgpu.createPerformanceStats({ graph: false });
stats.element.classList.add("performance-overlay");
wgpu.destroyPerformanceStats();

See Also