@os-team/next-nprogress
TypeScript icon, indicating that this package has built-in type declarations

1.0.32 • Public • Published

@os-team/next-nprogress NPM version BundlePhobia

Slim progress bar for Next.js applications.

Initializes nprogress for Next.js and applies styles using Emotion.

Usage

Step 1. Install the package

yarn add @os-team/next-nprogress

Step 2. Initialize nprogress in the ./pages/_app.tsx file

import React, { useEffect, useMemo } from 'react';
import { initNProgress, NProgressGlobalStyles } from '@os-team/next-nprogress';
import { ThemeProvider } from '@os-design/theming';
import { useRouter } from 'next/router';

const App: React.FC = ({ Component, pageProps }) => {
  const router = useRouter();

  // Initialize nprogress
  useEffect(() => {
    initNProgress(router);
  }, [router]);

  return (
    <ThemeProvider>
      <NProgressGlobalStyles />
      <Component {...pageProps} />
    </ThemeProvider>
  );
};

export default App;

Note that NProgressGlobalStyles must be inside ThemeProvider, as it uses the colorPrimary from theme.

Readme

Keywords

none

Package Sidebar

Install

npm i @os-team/next-nprogress

Weekly Downloads

107

Version

1.0.32

License

MIT

Unpacked Size

8.47 kB

Total Files

9

Last publish

Collaborators

  • oxilor