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

react-snap-page

v1.0.0

Published

Fullscreen snap scrolling for React

Downloads

113

Readme

react-snap-page

Lightweight fullscreen snap scrolling for React & Next.js.

Smooth section-based scrolling inspired by fullpage experiences without heavy dependencies.


Features

  • Fullscreen section snapping
  • Smooth scrolling animation
  • Mouse wheel navigation
  • Touch swipe support
  • Keyboard navigation
  • React 18+ support
  • Next.js compatible
  • TypeScript support
  • Lightweight
  • No external dependencies
  • ESM + CommonJS support

Installation

npm install react-snap-page

or

yarn add react-snap-page

or

pnpm add react-snap-page

Import CSS

Import the default styles once in your app.

Next.js App Router

import "react-snap-page/dist/index.css";

Usually inside:

app/layout.tsx

Basic Usage

"use client";

import { SnapPage, Section } from "react-snap-page";

import "react-snap-page/dist/index.css";

export default function Page() {
  return (
    <SnapPage>
      <Section>
        <div className="hero">
          <h1>Hero Section</h1>
        </div>
      </Section>

      <Section>
        <div className="about">
          <h1>About Section</h1>
        </div>
      </Section>

      <Section>
        <div className="projects">
          <h1>Projects Section</h1>
        </div>
      </Section>
    </SnapPage>
  );
}

Components

SnapPage

Main wrapper component.

Props

| Prop | Type | Default | Description | | ----------- | --------- | ------- | ----------------------------------------- | | duration | number | 1000 | Scroll animation duration in milliseconds | | threshold | number | 80 | Wheel/touch sensitivity threshold | | wheel | boolean | true | Enable mouse wheel scrolling | | touch | boolean | true | Enable touch swipe scrolling | | keyboard | boolean | true | Enable keyboard navigation |


Section

Fullscreen section component.

Props

| Prop | Type | Default | Description | | ----------- | -------- | ------- | ---------------- | | className | string | "" | Custom className |


Example With Props

"use client";

import { SnapPage, Section } from "react-snap-page";

import "react-snap-page/dist/index.css";

export default function HomePage() {
  return (
    <SnapPage
      duration={1200}
      threshold={60}
      wheel={true}
      touch={true}
      keyboard={true}
    >
      <Section className="section-one">
        <h1>Section One</h1>
      </Section>

      <Section className="section-two">
        <h1>Section Two</h1>
      </Section>

      <Section className="section-three">
        <h1>Section Three</h1>
      </Section>
    </SnapPage>
  );
}

Keyboard Controls

| Key | Action | | ------------ | ---------------- | | Arrow Down | Next section | | Arrow Up | Previous section | | Page Down | Next section | | Page Up | Previous section |


Touch Support

Mobile touch gestures are supported automatically.

| Gesture | Action | | ---------- | ---------------- | | Swipe Up | Next section | | Swipe Down | Previous section |


Styling

Default styles are minimal.

You can fully customize sections using your own CSS, Tailwind, or any styling library.

Example:

.section {
  display: flex;
  align-items: center;
  justify-content: center;
}

Tailwind Example

<Section className="bg-black text-white flex items-center justify-center">
  <h1 className="text-6xl font-bold">Hello World</h1>
</Section>

Next.js Example

app/layout.tsx

import "react-snap-page/dist/index.css";

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <body>{children}</body>
    </html>
  );
}

app/page.tsx

"use client";

import { SnapPage, Section } from "react-snap-page";

export default function Page() {
  return (
    <SnapPage>
      <Section>
        <h1>Hero</h1>
      </Section>

      <Section>
        <h1>About</h1>
      </Section>

      <Section>
        <h1>Projects</h1>
      </Section>
    </SnapPage>
  );
}

TypeScript Support

Built with TypeScript and includes full type definitions.

No additional typings required.


Browser Support

  • Chrome
  • Edge
  • Firefox
  • Safari
  • Mobile browsers

Accessibility Notes

Keyboard navigation is enabled by default.

You can disable it:

<SnapPage keyboard={false}>

Performance

  • Uses requestAnimationFrame
  • No heavy dependencies
  • Small bundle size
  • Optimized for smooth scrolling

Package Size

Approximate package size:

~3kb

Roadmap

Planned features:

  • Navigation dots
  • URL hash sync
  • Horizontal mode
  • Parallax support
  • Scroll callbacks
  • Nested scroll support
  • SSR hydration improvements
  • Section animations

Contributing

Contributions are welcome.

Feel free to open issues or pull requests.


License

MIT License