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

nextjs-rtl-loader

v1.1.0

Published

NextJs RTL Loader is a sleek, customizable top-loading progress bar for Next.js and React applications, designed with built-in RTL support.

Downloads

331

Readme

NextJs RTL Loader is a sleek, customizable top-loading progress bar for Next.js and React applications, designed with built-in RTL support.

Features

  • RTL Support: Designed with built-in RTL (right-to-left) support for seamless integration in RTL layouts.
  • Seamless Integration: Easily integrates with any React application.
  • Highly Customizable: Offers extensive customization with sensible defaults.
  • Smooth Animation: Features a custom implementation for smooth, visually appealing progress indications.
  • Dynamic Configuration: Configure color, height, speed, easing, and more to fit your needs.

Installation

To install NextJs RTL Loader, run the following command in your project directory:

npm install nextjs-rtl-loader

OR

yarn add nextjs-rtl-loader

Usage

To use NextJs RTL Loader in your Next.js application using the app router:

// app/layout.tsx
import NextLoader from "nextjs-rtl-loader";

export default function RootLayout({ children }) {
  return (
    <html>
      <NextLoader />
      {children}
    </html>
  );
}

To use NextJs RTL Loader in your Next.js application using the pages router:

import NextLoader from "nextjs-rtl-loader";

export default function App({ Component, pageProps }) {
  return (
    <>
      <NextLoader />
      <Component {...pageProps} />;
    </>
  );
}

Custom Configuration

import NextLoader from "nextjs-rtl-loader";

export default function RootLayout({ children }) {
  return (
    <html>
      <NextLoader
        color="#ff4500"
        height="1.5rem"
        speed={300}
        easing="linear"
        showSpinner
      />
      {children}
    </html>
  );
}

Prevent Trigger Loader

Prevent triggering the loader when clicking a button inside a Next.js :

To ensure that clicking a button within a Next.js does not inadvertently trigger the loader, use the following code to prevent default behavior and stop event propagation:

onClick={(e) => {
  e.preventDefault();
  e.nativeEvent.stopImmediatePropagation();
}}

API

<NextLoader /> accepts the following props for customization:

  • color (string): Specifies the color of the top-loading bar. Default: "#59a2ff" (a shade of blue).
  • initialPosition (number): Sets the initial position of the top-loading bar as a percentage of the total width. Default: 0.08 (8% of the total width).
  • height (number | string): Defines the height of the top-loading bar in pixels or css unit. Default: 4 pixels.
  • easing (string): Specifies the easing function to use for the loading animation. Accepts any valid CSS easing string. Default: "ease".
  • speed (number): Sets the animation speed of the top-loading bar in milliseconds. Default: 200 milliseconds.
  • zIndex (number): Defines the z-index property of the top-loading bar, controlling its stacking order. Default: 2147483647.
  • boxShadow (string): Sets the box-shadow property of the top-loading bar. Turned off by default.
  • showSpinner (boolean): Determines whether to accompany the loading bar with a spinner. Turned off by default.