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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@tomaszjarosz/react-article

v0.1.0

Published

Article reading components for React - progress bar, table of contents, bookmarks

Readme

@tomaszjarosz/react-article

Article reading utilities for React - progress bar, table of contents, and bookmarks.

Installation

npm install @tomaszjarosz/react-article

Requirements

  • React 17+ or 18+
  • Tailwind CSS

Components

Reading Progress Bar

import { ReadingProgressBar } from '@tomaszjarosz/react-article';

// Fixed progress bar at top of page
<ReadingProgressBar showPercentage />

// Customized colors
<ReadingProgressBar
  showPercentage={false}
  progressColor="bg-gradient-to-r from-purple-500 to-pink-500"
  completedColor="bg-green-500"
/>

Table of Contents

import { TableOfContents } from '@tomaszjarosz/react-article';

const tocItems = [
  { id: 'intro', text: 'Introduction', level: 2, originalText: 'Introduction' },
  { id: 'setup', text: 'Setup', level: 2, originalText: 'Setup' },
  { id: 'config', text: 'Configuration', level: 3, originalText: 'Configuration' },
  { id: 'advanced', text: 'Advanced', level: 2, originalText: 'Advanced Usage' },
];

<TableOfContents
  items={tocItems}
  title="Contents"
  showProgress
  scrollOffset={80}
/>

Features:

  • Active section highlighting
  • Smooth scroll navigation
  • Reading progress indicator
  • Hierarchical display (H2, H3, etc.)

Hooks

useReadingProgress

import { useReadingProgress } from '@tomaszjarosz/react-article';

function CustomProgressBar() {
  const progress = useReadingProgress(); // 0-100
  
  return <div style={{ width: `${progress}%` }} />;
}

useActiveSection

import { useActiveSection, type TableOfContentsItem } from '@tomaszjarosz/react-article';

function TOC({ items }: { items: TableOfContentsItem[] }) {
  const activeSection = useActiveSection(items);
  
  return (
    <ul>
      {items.map(item => (
        <li key={item.id} className={activeSection === item.id ? 'active' : ''}>
          {item.text}
        </li>
      ))}
    </ul>
  );
}

useScrollToSection

import { useScrollToSection } from '@tomaszjarosz/react-article';

function TOC() {
  const scrollToSection = useScrollToSection(80); // offset in px
  
  return (
    <button onClick={() => scrollToSection('intro')}>
      Go to Introduction
    </button>
  );
}

useBookmarks

import { useBookmarks } from '@tomaszjarosz/react-article';

function ArticleWithBookmarks({ slug }: { slug: string }) {
  const { 
    bookmarks,
    toggleBookmark,
    isBookmarked,
    clearAllBookmarks,
    bookmarkCount
  } = useBookmarks(slug);
  
  return (
    <div>
      <p>Bookmarks: {bookmarkCount}</p>
      <button onClick={() => toggleBookmark('section-1')}>
        {isBookmarked('section-1') ? 'Remove' : 'Add'} Bookmark
      </button>
    </div>
  );
}

Exports

import {
  // Components
  ReadingProgressBar,
  TableOfContents,
  
  // Hooks
  useReadingProgress,
  useActiveSection,
  useScrollToSection,
  useBookmarks,
  
  // Types
  type TableOfContentsItem,
} from '@tomaszjarosz/react-article';

License

MIT