---
url: "https://vueda.dev/v3/reference/api/js/use/usePageTitle/functions/usePageTitle.md"
title: "usePageTitle"
---

# usePageTitle

## Overview

Establish the page-title context (display role) or contribute to it (view role).

Calling with no argument returns the page-title context, establishing it on the first call up the
tree and reusing it thereafter (display role). The layout establishes it (so it sits above both
the title display and the routed views, which are usually siblings); the display reuses it to read
the title and host the action zone. Calling with a source getter injects that context and
registers the getter as the active title source (view role).

## Signature

`usePageTitle(source)`

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| <span id="param-source">source</span> | `() => PageTitleEntry` | no | A getter returning the current view's title and loading state. Omit to take the display role. |

### Returns

`PageTitleContext | () => void`

The context (display role); a cleanup function (view role with a context present); or `undefined` (view role with no context above, e.g. a view rendered standalone).

## Source

`client/lib/use/usePageTitle.js:38`
