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

@alex-fitzgerald/parchment

v0.0.5

Published

I love little scrollspies, particularly `notion's`. While they're simple as anything, I wanted to make my own.

Readme

📜 Parchment

I love little scrollspies, particularly notion's. While they're simple as anything, I wanted to make my own.

Parchment is a simple wee handful of headless components to help compose scrollspies. No dependencies other than the usual react

_Scroll_able... Parchment... 📜

Check out the demo here

Installation

npm install parchment

Done. No dependencies outside of react and react-dom.

Usage

First off the bat: we're using Context, so you'll need to wrap any parchment fellas with the ParchmentProvider.

Parchment

The scroll, which will have sections that can be scrolled to. Can accept any ReactNode children. Only ParchmentSections are observed by our parchment scrollspy.

import { Parchment } from 'parchment';

interface ParchmentOptions {
    /**
     * Sets the intersection threshold for all parchment sections.
     *
     * @default 0.5
     */
    intersectionThreshold?: number;
    /**
     * Sets options for the `scrollIntoView` method, when a ParchmentButton is clicked.
     *
     * @default { behavior: 'smooth', block: 'center' }
     */
    scrollIntoViewOptions?: ScrollIntoViewOptions;
    /**
     * Whether to enable scroll-snapping on the parchment container.
     *
     * @default false
     */
    snap?: boolean;
}

return (
    <Parchment snap={true} scrollIntoViewOptions={{ block: 'start' }} intersectionThreshold={0.3}>
        {...sections}
    </Parchment>
)

Sections

Any 'scrollable' sections should be wrapped in a ParchmentSection component. This will register the section with the context.

import { Parchment, ParchmentSection } from 'parchment';

function MyScrollableSections() {
    return (
        <Parchment>
            <ParchmentSection section="my-section">
                {/* Your content here */}
            </ParchmentSection>
        </Parchment>
    );
}

Buttons

Parchment buttons are wired up to know when their associated section is in view. An 'active' class is applied to the button, or passed as a boolean argument to a function.

.active class

import ParchmentButton from 'parchment';

/*
 * .parchment-button.active {
 *      color: rebeccapurple;
 * }
 */
function MyButton() {
  return (
    <ParchmentButton section="my-section">
        My Section Name
    </ParchmentButton>
  );
}

active argument

/**
 * If the `ParchmentButton` child is a function, it is called
 * with a boolean reflecting whether the section is in view.
 */
function MyButton() {
  return (
    <ParchmentButton section="my-section">
        {(active) => (
            <div style={{ color: active ? 'rebeccapurple' : 'blue' }}>
                My Section Name
            </div>
        )}
    </ParchmentButton> 
  );
}

So, at the end of the day, we're up and away with the following:

import { Parchment, ParchmentSection, ParchmentButton } from 'parchment';

function MyScrollableSections() {
    return (
        <ParchmentProvider>
            <ParchmentButton section="my-section">
                My Section Name
            </ParchmentButton>
            <Parchment>
                <ParchmentSection section="my-section">
                    {/* Your content here */}
                </ParchmentSection>
            </Parchment>
        </ParchmentProvider>
    );
}

Other APIS

useParchment

The useParchment hook provides a few useful functions for interacting with the Parchment context.

scrollTo

Uses the window's native scrollIntoView method to scroll to a section by key, but with options loaded in the parchment context.

inView

Returns the key of the section currently in viewport, e.g.:

import { useParchment } from 'parchment';

function MyComponent() {
    const { scrollTo, inView } = useParchment();

    console.log(inView); // 'my-section'

    return (
        <button onClick={() => scrollTo('my-section')}>
            Scroll to my section
        </button>
    );
}

ScrollOptions

Parchment accepts the global ScrollIntoViewOptions object as a prop.

Contributions

Feel free to contribute. Has the default vite scripts, so to get up and running after cloning just run npm run dev.

TODO:

  • [ ] Add tests
  • [ ] Add more features
  • [ ] Add horizontal/vertical option
  • [ ] Add asChild prop to ParchmentButton to allow for custom components
  • [ ] Add threshold prop to ParchmentButton to allow for custom scroll thresholds
  • [ ] Add percentInView option?
  • [ ] Review from performance perspective - what needs to be memoised?