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 🙏

© 2024 – Pkg Stats / Ryan Hefner

next-app-router-transitions

v2.0.4

Published

Sleek and seamless page transitions for Next.js App Router - Elevate your app's UX with fluid navigation

Downloads

13

Readme

Next App Router Transitions 🚀

Elevate your Next.js App Router projects with silky-smooth page transitions! This package provides an easy-to-use component that adds fluid animations between route changes, enhancing the overall user experience of your Next.js applications.

Features

  • 🎭 Multiple transition effects (block, multiBlock, blinds)
  • 🔧 Fully customizable (duration, ease, colors)
  • 📱 Responsive and accessible
  • 🧩 Seamless integration with Next.js App Router
  • 🪶 Lightweight with minimal setup

Installation

npm install next-app-router-transitions framer-motion

Important: This package requires framer-motion as a peer dependency. Make sure to install it alongside the package.

Usage

To use Next App Router Transitions in your project, follow these steps:

  1. Create a new client component in your app directory, e.g., app/TransitionLayout.tsx:
"use client";

import { TransitionWrapper } from "next-app-router-transitions";

export default function TransitionLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <TransitionWrapper
      transitionType="block"
      duration={0.5}
      backgroundColor="#000">
      {children}
    </TransitionWrapper>
  );
}
  1. Use this component in your root layout (app/layout.tsx):
import TransitionLayout from "./TransitionLayout";

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

This setup ensures that the transition effects are applied consistently across your entire application.

API

The TransitionWrapper component accepts the following props:

| Prop | Type | Default | Description | | --------------- | ------------------ | ----------- | ----------------------------------------------------------- | | transitionType | string | 'block' | Type of transition effect ('block', 'multiBlock', 'blinds') | | duration | number | 0.75 | Duration of the transition in seconds | | backgroundColor | string | 'black' | Background color of the transition element | | ease | string | number[] | 'easeInOut' | Easing function for the transition | | zIndex | number | 50 | z-index of the transition element |

Examples

Block Transition

<TransitionWrapper transitionType="block" duration={0.5} backgroundColor="#000">
  {children}
</TransitionWrapper>

MultiBlock Transition

<TransitionWrapper
  transitionType="multiBlock"
  duration={0.7}
  backgroundColor="#fff">
  {children}
</TransitionWrapper>

Blinds Transition

<TransitionWrapper
  transitionType="blinds"
  duration={0.6}
  backgroundColor="#333">
  {children}
</TransitionWrapper>

Troubleshooting

If you encounter any issues, ensure that:

  1. You have installed framer-motion as a peer dependency.
  2. You're using the TransitionWrapper in a client component (with the "use client" directive).
  3. The TransitionWrapper is placed as high as possible in your component tree, ideally in the root layout.
  4. You have the correct peer dependencies installed (react, react-dom, next, framer-motion).

Contributing

We welcome contributions! Please see our Contributing Guide for more details.

License

MIT © Theogene Junior | @theogenejr


Happy coding! If you enjoy smooth transitions in your Next.js App Router projects, don't forget to give us a star on GitHub! ⭐