Gathering detailed insights and metrics for @osdiab/next-nprogress-bar
Gathering detailed insights and metrics for @osdiab/next-nprogress-bar
Gathering detailed insights and metrics for @osdiab/next-nprogress-bar
Gathering detailed insights and metrics for @osdiab/next-nprogress-bar
BProgress is a lightweight, customizable progress bar for better user experience.
npm install @osdiab/next-nprogress-bar
Typescript
Module System
Node Version
NPM Version
71.4
Supply Chain
98.8
Quality
76.2
Maintenance
100
Vulnerability
100
License
@bprogress/next@3.2.12
Updated on Apr 14, 2025
@bprogress/remix@1.0.19
Updated on Apr 14, 2025
@bprogress/react@1.2.7
Updated on Apr 14, 2025
@bprogress/vue@1.1.5
Updated on Apr 14, 2025
@bprogress/core@1.3.4
Updated on Apr 14, 2025
@bprogress/next@3.2.10
Updated on Mar 14, 2025
TypeScript (66.05%)
MDX (22.49%)
Vue (5.04%)
CSS (2.79%)
JavaScript (2.02%)
HTML (1.6%)
Total Downloads
1,048
Last Day
4
Last Week
11
Last Month
40
Last Year
937
MIT License
544 Stars
193 Commits
38 Forks
1 Watchers
1 Branches
20 Contributors
Updated on May 13, 2025
Minified
Minified + Gzipped
Latest Version
2.5.2
Package Id
@osdiab/next-nprogress-bar@2.5.2
Unpacked Size
73.91 kB
Size
14.12 kB
File Count
10
NPM Version
9.8.1
Node Version
18.18.2
Published on
May 27, 2024
Cumulative downloads
Total Downloads
Last Day
300%
4
Compared to previous day
Last Week
83.3%
11
Compared to previous week
Last Month
-23.1%
40
Compared to previous month
Last Year
744.1%
937
Compared to previous year
NProgress integration on Next.js compatible with /app and /pages folders
1npm install next-nprogress-bar
or
1yarn add next-nprogress-bar
Import it into your /pages/_app(.js/.jsx/.ts/.tsx) or /app/layout(.js/.jsx/.ts/.tsx) folder
1// In app directory 2import { AppProgressBar as ProgressBar } from 'next-nprogress-bar'; 3 4// In pages directory 5import { PagesProgressBar as ProgressBar } from 'next-nprogress-bar';
1<ProgressBar />
1import { PagesProgressBar as ProgressBar } from 'next-nprogress-bar'; 2 3export default function App({ Component, pageProps }) { 4 return ( 5 <> 6 <Component {...pageProps} /> 7 <ProgressBar 8 height="4px" 9 color="#fffd00" 10 options={{ showSpinner: false }} 11 shallowRouting 12 /> 13 </> 14 ); 15}
1import type { AppProps } from 'next/app'; 2import { PagesProgressBar as ProgressBar } from 'next-nprogress-bar'; 3 4export default function App({ Component, pageProps }: AppProps) { 5 return ( 6 <> 7 <Component {...pageProps} /> 8 <ProgressBar 9 height="4px" 10 color="#fffd00" 11 options={{ showSpinner: false }} 12 shallowRouting 13 /> 14 </> 15 ); 16}
1// In /app/layout.jsx 2'use client'; 3 4import { AppProgressBar as ProgressBar } from 'next-nprogress-bar'; 5 6export default function RootLayout({ children }) { 7 return ( 8 <html lang="en"> 9 <body> 10 {children} 11 <ProgressBar 12 height="4px" 13 color="#fffd00" 14 options={{ showSpinner: false }} 15 shallowRouting 16 /> 17 </body> 18 </html> 19 ); 20}
1// Create a Providers component to wrap your application with all the components requiring 'use client', such as next-nprogress-bar or your different contexts... 2'use client'; 3 4import { AppProgressBar as ProgressBar } from 'next-nprogress-bar'; 5 6const Providers = ({ children }) => { 7 return ( 8 <> 9 {children} 10 <ProgressBar 11 height="4px" 12 color="#fffd00" 13 options={{ showSpinner: false }} 14 shallowRouting 15 /> 16 </> 17 ); 18}; 19 20export default Providers;
1// Import and use it in /app/layout.jsx 2import Providers from './providers'; 3 4export const metadata = { 5 title: 'Create Next App', 6 description: 'Generated by create next app', 7}; 8 9export default function RootLayout({ children }) { 10 return ( 11 <html lang="en"> 12 <body> 13 <Providers>{children}</Providers> 14 </body> 15 </html> 16 ); 17}
1// In /app/layout.tsx 2'use client'; 3 4import { AppProgressBar as ProgressBar } from 'next-nprogress-bar'; 5 6export default function RootLayout({ 7 children, 8}: { 9 children: React.ReactNode; 10}) { 11 return ( 12 <html lang="en"> 13 <body> 14 {children} 15 <ProgressBar 16 height="4px" 17 color="#fffd00" 18 options={{ showSpinner: false }} 19 shallowRouting 20 /> 21 </body> 22 </html> 23 ); 24}
1// Create a Providers component to wrap your application with all the components requiring 'use client', such as next-nprogress-bar or your different contexts... 2'use client'; 3 4import { AppProgressBar as ProgressBar } from 'next-nprogress-bar'; 5 6const Providers = ({ children }: { children: React.ReactNode }) => { 7 return ( 8 <> 9 {children} 10 <ProgressBar 11 height="4px" 12 color="#fffd00" 13 options={{ showSpinner: false }} 14 shallowRouting 15 /> 16 </> 17 ); 18}; 19 20export default Providers;
1// Import and use it in /app/layout.tsx 2import Providers from './providers'; 3 4export const metadata = { 5 title: 'Create Next App', 6 description: 'Generated by create next app', 7}; 8 9export default function RootLayout({ 10 children, 11}: { 12 children: React.ReactNode; 13}) { 14 return ( 15 <html lang="en"> 16 <body> 17 <Providers>{children}</Providers> 18 </body> 19 </html> 20 ); 21}
You can disable the progress bar on specific links by adding the data-disable-nprogress={true}
attribute.
/!\ This will not work for Link in svg elements.
1<Link href="#features" data-disable-nprogress={true}> 2 Features 3</Link>
You can prevent the progress bar from starting by adding the data-prevent-nprogress={true}
attribute.
1<Link href="/dashboard"> 2 <span>Dashboard</span> 3 <span onClick={(e) => e.preventDefault()} data-prevent-nprogress={true}> 4 preventDefault 5 </span> 6</Link>
Height of the progress bar - by default 2px
Color of the progress bar - by default #0A2FFF
by default undefined
See NProgress docs
If the progress bar is not displayed when you only change URL parameters without changing route - by default false
See Next.js docs
The position the progress bar starts at from 0 to 1 - by default 0
When the page loads faster than the progress bar, it does not display - by default 0
Disable the progress bar when the target URL is the same as the current URL - by default true
The delay in milliseconds before the progress bar stops - by default 0
A cryptographic nonce (number used once) used to declare inline scripts for Content Security Policy - by default undefined
A cryptographic nonce (number used once) used to declare inline scripts for Content Security Policy - by default true
Your custom CSS - by default NProgress CSS
Activates a detailed comparison of component props to determine if a rerender is necessary.
When true
, the component will only rerender if there are changes in key props such as color
, height
, shallowRouting
, delay
, options
, and style
.
This is useful for optimizing performance in scenarios where these props change infrequently. If not provided or set to false
, the component will assume props have not changed and will not rerender, which can enhance performance in scenarios where the props remain static. - by default undefined
Provides a custom function to preprocess the target URL before comparing it with the current URL.
This is particularly useful in scenarios where URLs undergo transformations, such as localization or path modifications, after navigation.
The function takes a URL
object as input and should return a modified URL
object.
If this prop is provided, the preprocessed URL will be used for comparisons, ensuring accurate determination of whether the navigation target is equivalent to the current URL.
This can prevent unnecessary display of the progress bar when the target URL is effectively the same as the current URL after preprocessing. - by default undefined
1import { useRouter } from 'next-nprogress-bar';
1router.push(url: string, options?: NavigateOptions, NProgressOptions?: RouterNProgressOptions) 2router.replace(url: string, options?: NavigateOptions, NProgressOptions?: RouterNProgressOptions) 3router.back(NProgressOptions?: RouterNProgressOptions)
NavigateOptions
is the options of the next router.
1interface RouterNProgressOptions { 2 showProgressBar?: boolean; 3 startPosition?: number; 4 disableSameURL?: boolean; 5}
Replace your 'next/navigation' routers with this one. It's the same router, but this one supports NProgress.
1const router = useRouter(); 2 3// With progress bar 4router.push('/about'); 5router.replace('/?counter=10'); 6router.back();
1// before (v1) 2import ProgressBar from 'next-nprogress-bar'; 3 4<ProgressBar 5 height="4px" 6 color="#fffd00" 7 options={{ showSpinner: false }} 8 shallowRouting 9/>; 10 11// after (v2) 12import { PagesProgressBar as ProgressBar } from 'next-nprogress-bar'; 13 14<ProgressBar 15 height="4px" 16 color="#fffd00" 17 options={{ showSpinner: false }} 18 shallowRouting 19/>;
1// before (v1) 2import ProgressBar from 'next-nprogress-bar'; 3 4<ProgressBar 5 height="4px" 6 color="#fffd00" 7 options={{ showSpinner: false }} 8 appDirectory 9 shallowRouting 10/>; 11 12// after (v2) 13import { AppProgressBar as ProgressBar } from 'next-nprogress-bar'; 14 15<ProgressBar 16 height="4px" 17 color="#fffd00" 18 options={{ showSpinner: false }} 19 shallowRouting 20/>;
Please file an issue for bugs, missing documentation, or unexpected behavior.
MIT
No vulnerabilities found.
No security vulnerabilities found.