ImFusion Web SDK

ImFusionCanvas

ts
const ImFusionCanvas: ForwardRefExoticComponent<
  CanvasHTMLAttributes<HTMLCanvasElement> & RefAttributes<HTMLCanvasElement>
>;

Renders a canvas element and registers it with the ImFusionProvider.

When this component mounts, it triggers SDK initialization by registering the canvas element with the parent provider. All standard HTML canvas attributes are passed through to the underlying <canvas> element.

Examples

tsx
<ImFusionProvider>
  <ImFusionCanvas style={{ width: '100%', height: '100vh' }} className="viewer-canvas" />
</ImFusionProvider>
tsx
// Accessing the canvas element via ref
const canvasRef = useRef<HTMLCanvasElement>(null);
<ImFusionCanvas ref={canvasRef} width={800} height={600} />;

On this page