npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-use-title

v1.0.0

Published

A lightweight React hook for managing document titles.

Readme

react-use-title

A lightweight and customizable React hook for managing document titles with support for prefixes, suffixes, custom separators, title restoration, and page visibility changes.

Features

  • 🚀 Lightweight and easy to use
  • ⚛️ Built for React 18 and React 19
  • 📝 Set the document title with a simple API
  • 🔖 Add custom prefixes and suffixes
  • ✨ Customize the separator between title parts
  • 🔄 Restore the previous title on unmount
  • 👀 Change the title when the page becomes hidden
  • 💙 Fully written in TypeScript

Recat TS npm

Installation

Usage

1_Basic:

export default function App() {
  useTitle("Dashboard")
  return <h1>react-use-title</h1>;
}

Preview


2_Prefix:

export default function App() {
  useTitle("Dashboard",{
    prefix:"Admin"
  })
  return <h1>react-use-title</h1>;
}

Preview


3_Suffix:

export default function App() {
  useTitle("Dashboard",{
    suffix:"My App"
  })
  return <h1>react-use-title</h1>;
}

Preview


4_separator

export default function App() {
  useTitle("Dashboard",{
    prefix:"Admin",
    suffix:"My App",
    separator:"😍"
  })
  return <h1>react-use-title</h1>;
}

Preview

Default

Using Separator


5_onHidden

export default function App() {
  useTitle("Dashboard",{
    prefix:"Admin",
    suffix:"My App",
    separator:"😍",
    onHidden:{title:"Why Did You Leave? 😐"}
  })
  return <h1>react-use-title</h1>;
}

Previwe (GIF may take a few seconds to load)

API

useTitle

useTitle(title: string, options?: UseTitleOptions): void

Parameters

| Parameter | Type | Description | |-----------|------|-------------| | title | string | The document title. | | options | UseTitleOptions | Optional configuration object. |

UseTitleOptions

| Option | Type | Default | Description | |--------|------|---------|-------------| | prefix | string | undefined | Adds text before the title. | | suffix | string | undefined | Adds text after the title. | | separator | string | "\|" (Pipe) | Separator between title parts. | | restoreOnUnmount | boolean | false | Restores the previous document title when the component unmounts. | | onHidden | { title: string } | undefined | Changes the document title when the page becomes hidden. |

License

This project is licensed under the MIT License. See the LICENSE file for details.