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

@rgglez/astro-tocbutton

v0.1.5

Published

Floating TOC button for Astro blog posts. Reads h2–h6 headings from #article and renders a popover with navigation links. Requires Tailwind CSS.

Readme

astro-tocbutton

License GitHub all releases GitHub issues GitHub commit activity GitHub release GitHub stars GitHub forks

astro-tocbutton generates a floating table-of-contents button for Astro blog posts. Reads h2h6 headings from a #article element and renders a popover with navigation links. Positioned bottom-left by default (so it does not conflict with a bottom-right back-to-top button), and configurable to any corner. RTL-aware: placement mirrors automatically under dir="rtl".

Installation

npm install @rgglez/astro-tocbutton

Usage

import TocButton from "@rgglez/astro-tocbutton";

<TocButton />

Optional props

| Prop | Type | Default | Description | |------------|-------------------------------------------------------------|------------------|-----------------------------------------------------------------------------| | label | string | "Table of contents" | aria-label for the toggle button | | position | "bottom-left" \| "bottom-right" \| "top-left" \| "top-right" | "bottom-left" | Fixed corner for the button. Uses logical edges, so it mirrors under RTL. |

<TocButton position="top-right" label="On this page" />

Under dir="rtl", *-left placements resolve to the right edge and *-right to the left (the inline-start/inline-end edges flip automatically).

Requirements

  • Astro ≥ 5.7 — the icon is imported as a native SVG component (import Icon from "./icon.svg"), supported from Astro 5.7 onward.
  • The article content must be wrapped in an element with id="article". Headings (h2h6) inside it must have id attributes (Astro / remark sets these automatically for markdown/MDX).
  • Tailwind CSS ≥ 3.3 must be configured in your project (logical start-*/end-* utilities, used for RTL-aware positioning, were added in 3.3). If using Tailwind v4, add the package source to your content scan so utility classes are not purged:
/* global.css (v4) */
@source "../node_modules/@rgglez/astro-tocbutton/src";

Behavior

  • Button is always visible on pages that contain headings; hidden if #article has none.
  • Clicking the button opens/closes a popover anchored to it (above the button for bottom-* positions, below it for top-*).
  • Headings are indented by level: h2 = no indent, h3 = pl-4, h4 = pl-8, h5 = pl-10, h6 = pl-12.
  • Clicking a heading link closes the popover and scrolls to the section.
  • Also closes on Escape or click outside.
  • Compatible with Astro View Transitions (data-astro-rerun guard prevents duplicate listeners).

Development

| Target | Description | |---------------|-----------------------------------------------------------| | make tags | List git tags sorted by semver (descending) | | make patch | Bump PATCH version in package.json, commit, tag, push | | make publish| Publish current version to npm |

Typical release flow: make patchmake publish.

License

Copyright (C) 2026 Rodolfo González González.

Licensed under the Apache v2.0 license. Read the LICENSE file.