Docs
useDocumentTitle

Dynamically update the document title. Pass a string, and the document title updates whenever the value changes.

Click to increment the counter and watch the document title update in real-time!

Installation

pnpm dlx shadcn@latest add https://hookcn.ouassim.tech/r/use-document-title

Usage

import { useDocumentTitle } from "@/hooks/use-document-title"
 
export function Component() {
  useDocumentTitle("New title for my page")
 
  return <div>...</div>
}

API Reference

Parameters

NameTypeDescription
titlestringThe new title to set for the document.