Access the underlying plotly.js DOM element via Refs
mainYou can attach a ref to the <Plot> component. The resolved ref will be the rendered <div> element (the plotly graph div). This allows you to call low-level plotly.js APIs directly on the element, such as Plotly.toImage(ref.current).
const plotRef = useRef<HTMLDivElement>(null);
// Later in an effect or handler
if (plotRef.current) {
// Call low-level plotly.js APIs
// Plotly.toImage(plotRef.current);
}
<Plot ref={plotRef} ... />