---
title: "dom:beforeRender Hook · Unhead"
canonical_url: "https://unhead.unjs.io/docs/typescript/head/api/hooks/dom-before-render"
last_updated: "2026-09-10T21:49:27.488Z"
meta:
  description: "Synchronous hook for allowing or canceling a pending client-side DOM render."
  "og:description": "Synchronous hook for allowing or canceling a pending client-side DOM render."
  "og:title": "dom:beforeRender Hook · Unhead"
---

Home

`
Unhead on GitHub

Switch to TypeScriptSwitch to VueSwitch to ReactSwitch to SvelteSwitch to Solid.jsSwitch to AngularSwitch to Nuxt

**Hooks**

# **dom:beforeRender Hook**

[Copy for LLMs](https://raw.githubusercontent.com/unjs/unhead/refs/heads/main/docs/head/7.api/hooks/09.dom-before-render.md)

The `**dom:beforeRender**` hook runs immediately before the client renderer resolves tags and patches the document. Set `**ctx.shouldRender**` to `**false**` to cancel that render.

## Hook Signature

```
export interface Hook {
  'dom:beforeRender': (ctx: DomBeforeRenderCtx) => SyncHookResult
}

interface DomBeforeRenderCtx {
  shouldRender: boolean
  tags: HeadTag[]
}
```

The hook is synchronous. In the current renderer, `**ctx.tags**` is initialized to an empty array because tag resolution happens after this hook. Use a `**tags:***` hook to inspect tags.

Canceling a render does not clear the head's dirty state. A later update or explicit `**head.render()**` call can try again.

## Usage Example

```
import { defineHeadPlugin } from 'unhead/plugins'

export function pauseDomRendering(isPaused: () => boolean) {
  return defineHeadPlugin({
    key: 'pause-dom-rendering',
    hooks: {
      'dom:beforeRender': (ctx) => {
        if (isPaused())
          ctx.shouldRender = false
      }
    }
  })
}
```

[Edit this page](https://github.com/unjs/unhead/edit/main/docs/head/7.api/hooks/09.dom-before-render.md)

[Markdown For LLMs](https://raw.githubusercontent.com/unjs/unhead/refs/heads/main/docs/head/7.api/hooks/09.dom-before-render.md)

**Did this page help you? **

[**tags:afterResolve** Final synchronous tag-resolution hook before sanitization and rendering.](https://unhead.unjs.io/docs/head/api/hooks/tags-after-resolve) [**ssr:streamChunk** Hook for inspecting the tags that resolve after the SSR shell has streamed.](https://unhead.unjs.io/docs/head/api/hooks/ssr-stream-chunk)

**On this page **

- [Hook Signature](#hook-signature)
- [Usage Example](#usage-example)