Skip to main content
The no-dom-access rule prevents usage of the document object and DOM APIs in UI extensions.

Rule details

UI extensions run in a sandboxed web worker environment where the DOM is intentionally unavailable. This architectural constraint ensures security and stability by preventing extensions from accessing sensitive host application data, modifying the main HubSpot interface, or interfering with other extensions. The document object and DOM APIs don’t exist at runtime. Attempting to use them will cause runtime errors. Instead, build your UI entirely with React components and hooks from @hubspot/ui-extensions.

DOM alternatives

Use the following UI extension alternatives instead of DOM APIs: See the next section for an example of each alternative.

Examples

Querying elements

Instead of using document.querySelector() or document.getElementById():
Build your UI with UI components:

Element references

Instead of using document.getElementById() in effects:
Use React refs and component props:

Data fetching

Instead of fetching data and manipulating the DOM:
Use CRM data fetching hooks and React state:
Last modified on March 29, 2026