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

@hex2r/react-announcer

v0.1.2

Published

Accessible announcer component for React apps using the Context API. Renders live-region messages for screen readers and provides a simple hook for dispatching announcements from anywhere in your component tree.

Readme

react-announcer

Accessible announcer component for React apps using the Context API.
Renders live-region messages for screen readers and provides a simple hook for dispatching announcements from anywhere in your component tree.

🔊 Perfect for accessibility-friendly UIs, form feedback, status updates, or dynamic ARIA alerts.

This package simplifies the process of announcing messages to screen readers by:

  • Managing announcements via React Context

  • Offering a default AnnouncementRegion component (screen reader only)

  • Allowing you to create your own custom rendering of announcements

  • Supporting both polite and assertive modes for Screen Readers

📦 Installation

npm:

npm install --save-dev @hex2r/react-announcer

pnpm:

pnpm install --save-dev @hex2r/react-announcer

yarn:

yarn add -D @hex2r/react-announcer

Peer Dependencies

react version ^18.3.0

Usage in your components

Do it easy using useAnnouncer() hook

const { announce } = useAnnouncer()

...
const handleClick = () => {
  announce({ message: "Assertive hello from demo!", assertive: true })
}
...

📦 API Reference

<AnnouncerProvider>

Wraps your app and provides announcements state and dispatch function via context.

<AnnouncerProvider>
  {(announcements) => (
    <>
      <AnnouncementRegion announcements={announcements} />
      {/* ... */}
    </>
  )}
</AnnouncerProvider>

useAnnouncer() hook

Hook to dispatch announcements.

const { announce } = useAnnouncer()
announce({ message: "User created", assertive: false })

AnnouncementRegion

Component that renders screen-reader accessible messages

| Prop | Type | Default | Description | | ----------------- | ---------------- | ------- | ------------------------------------------------------------------ | | announcements | Announcement[] | — | List of current announcements | | srOnlySupported | boolean | false | Use className="sr-only" instead of inline visually hidden styles | | stackLimit | number | 4 | Number of last announcements to display |

<AnnouncementRegion
  announcements={announcements}
  srOnlySupported
  stackLimit={3}
/>

♿ Accessibility Notes

The AnnouncementRegion component ensures that assistive technology is notified of updates using aria-live and appropriate roles (status for polite, alert for assertive).

If you're using Tailwind or already have an .sr-only class, you can pass srOnlySupported={true} to avoid inline styles.

Supports announcing multiple messages with stackLimit.