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

@dorixdev/react-dual-scroll-sync

v2.1.1

Published

A lightweight React library to synchronize navigation menus with scrollable content sections.

Readme

@dorixdev/react-dual-scroll-sync

A lightweight React library to synchronize a vertical navigation menu with scrollable content sections. Ideal for advanced catalogs, filter drawers, and any layout that needs a sticky nav that tracks the visible section and enables smooth scroll.

npm version Release to npm docs bundle size license

📑 Table of Contents

💡 Features

  • 🔗 Sync state between a vertical nav and the currently visible content section
  • 🧭 Programmatic scroll to a section when a menu item is selected
  • Active item highlighting and nav auto-scroll to keep it in view
  • 🎨 Themable styles: override CSS variables to match your design
  • 🧪 Typed (TypeScript) & framework-agnostic CSS

🎥 Demo

📦 Installation

pnpm add @dorixdev/react-dual-scroll-sync
# or
npm i @dorixdev/react-dual-scroll-sync

💄 Styles

Import the packaged CSS once in your app:

// e.g., main.tsx or App.tsx
import '@dorixdev/react-dual-scroll-sync/styles.css';

🚀 Quick start

import { DualScrollSync } from '@dorixdev/react-dual-scroll-sync';

const items = [
	{ sectionKey: 's1', label: 'Section 1', children: <div>…</div> },
	{ sectionKey: 's2', label: 'Section 2', children: <div>…</div> },
	{ sectionKey: 's3', label: 'Section 3', children: <div>…</div> }
];

export default function Demo() {
	return <DualScrollSync items={items} />;
}

🧩 Usage Patterns

DualScrollSync can be used in two main ways: data-driven and declarative.

Data-Driven

Define your sections in an array and let the component generate both nav items and content.

✅ Best for dynamic data (e.g. from CMS or API).

const items = [
	{ sectionKey: 'intro', label: 'Introduction', children: <div>...</div> },
	{ sectionKey: 'details', label: 'Details', children: <div>...</div> }
];

return <DualScrollSync items={items} onItemClick={handleClick} />;

Declarative

Write the structure directly in JSX using DualScrollSync.NavItem and DualScrollSync.ContentSection.

✅ Best for static pages where you want full control.

return (
	<DualScrollSync onItemClick={handleClick}>
		<DualScrollSync.Nav>
			<DualScrollSync.NavItem sectionKey="intro">Introduction</DualScrollSync.NavItem>
			<DualScrollSync.NavItem sectionKey="details">Details</DualScrollSync.NavItem>
		</DualScrollSync.Nav>

		<DualScrollSync.Content>
			<DualScrollSync.ContentSection sectionKey="intro">
				<DualScrollSync.Label>Introduction</DualScrollSync.Label>
				<div>...</div>
			</DualScrollSync.ContentSection>
			<DualScrollSync.ContentSection sectionKey="details">
				<DualScrollSync.Label>Details</DualScrollSync.Label>
				<div>...</div>
			</DualScrollSync.ContentSection>
		</DualScrollSync.Content>
	</DualScrollSync>
);

⚖️ When to use

✅ Long scrollable pages with sticky nav

✅ Catalog filters, docs sidebars, multi-section layouts

❌ Very short content (no scrolling needed)

❌ Complex nested navs (not supported)

📘 Documentation

Explore all props, variations, and usage guidelines in the Storybook docs.

License

This project is licensed under the MIT License.