Skip to content

useDocTitle

Set the document's title with an optional prefix.

Parameters

NameDescription
titleThe title to set.
prefixAn optional prefix to prepend to the title.

Returns

(title: string, prefix?: string) => void
(title: string, prefix?: string) => void

Examples

ts
useDocTitle('New Title')
document.title // DefaultPrefix New Title

useDocTitle('New Title', 'MyPrefix')
document.title // MyPrefix New Title
useDocTitle('New Title')
document.title // DefaultPrefix New Title

useDocTitle('New Title', 'MyPrefix')
document.title // MyPrefix New Title

Released under the GNU GPLv3 License.