
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
react-top-progress
Advanced tools
A lightweight, modern, and performant top loading progress bar for React. Built for seamless user experiences with zero dependencies!
Perfect for Next.js App Router, Vite, and standard SPA architectures.
withProgress for API fetchingnpm install react-top-progress
This approach automatically provides all routing configurations and is incredibly clean.
import { ProgressProvider, useAutoProgress } from "react-top-progress";
export default function RootLayout({ children }) {
// Use generic auto-route progress detector or just trigger global effects
// Optional but recommended for easy routing coverage!
return (
<ProgressProvider color="#29D" height={3} shadow={true}>
{children}
</ProgressProvider>
);
}
Because Next.js App Router removed native router events, you can quickly auto-wire progress with the useRouteProgress hook, which intrinsically detects all link navigation globally using zero-external dependencies!
"use client";
import { TopProgress, useRouteProgress } from "react-top-progress";
export default function Layout({ children }) {
useRouteProgress(); // Auto-detects clicks, routing events, and history pushState!
return (
<>
<TopProgress
height={4}
color="linear-gradient(90deg, #ff5500, #ff0080)"
/>
{/* Your Top Nav, Sidebar, etc. */}
{children}
</>
);
}
You can trigger the loader from anywhere in your codebase by importing the functions globally, or via a React ref assigned to <TopProgress ref={myRef} />.
| Method | Parameters | Description |
|---|---|---|
start(loaderType?) | "continuous" | "static" | Starts the loading indicator. Default is continuous. |
continuousStart(startingValue?, refreshRate?) | number, number | Starts with a random value (20-30), then slowly ticks up (2-10) repetitively. Reaches max 90%. |
staticStart(startingValue?) | number | Starts the loader with a random static value between 30-50, waiting for completion. |
complete() / finishProgress() | Instantly pushes the indicator to 100% and gracefully fades it out. | |
resetProgress() | Instantly zeroes out and hides the progress bar without fading. | |
increase(value) | number | Manually increments the loader by a specific amount. |
decrease(value) | number | Manually decrements the loader by a specific amount. |
setProgress(value) | number | Hardsets to a specific progress percentage. |
getProgress() | Returns the current progress percentage (0 - 100). | |
withProgress(promise) | Promise<T> | Wraps an asynchronous action. startProgress() executes automatically before and completes automatically afterward. |
import { withProgress } from "react-top-progress";
const data = await withProgress(fetch("/api/users"));
You can customize <TopProgress /> passing any of the following props:
| Property | Type | Default | Description |
|---|---|---|---|
progress | number | Hardset the progress (0-100) if you want to bypass the internal store and control state yourself. | |
color | string | "#29D" | Background color of the bar. Accepts linear-gradient(...) or hex codes. |
height | number | 3 | Height of the progress bar in pixels. |
shadow | boolean | true | Appends a glorious trailing drop-glow peg matching the bar's color tracking its head. |
background | string | "transparent" | Fills the container div's background layer under the progress element. |
transitionSpeed | number | 200 | Fade transition time (ms) for the fade-out completion sequence. |
loaderSpeed | number | 500 | Loader width transition speed (ms). |
waitingTime | number | 1000 | The delay time (ms) loader waits at 100% width before fading entirely out. |
easing | string | "cubic-bezier(0.4, 0, 0.2, 1)" | Customizable CSS animation timing path curve. |
style | CSSProperties | Inject custom JSX styles directly onto the loader element. | |
className | string | Apply a specific custom CSS class to the loader element. | |
containerStyle | CSSProperties | Configure inline styles for the fixed <div /> wrapper container. | |
containerClassName | string | Custom CSS class applied onto the wrapper container. | |
onLoaderFinished | () => void | A callback function executing precisely when the loader fully hits 100% max width. |
Developers need to know why to switch. Here is the breakdown:
| Library | Dependencies | SSR Safe | Routing Bindings | Promise Wrap | Bundle Size |
|---|---|---|---|---|---|
nprogress | Old jQuery style logic | No | ❌ | ❌ | Larger |
nextjs-toploader | Next-specific only | Yes | ✅ (Next.js) | ❌ | Medium |
react-top-loading-bar | React mostly | Some | ❌ | ❌ | Medium |
| react-top-progress | 0 dependencies | Yes | ✅ (Agnostic) | ✅ | Tiny (~1.9kb) |
Designed for the modern web. Inspired by the classic nprogress and Next.js' nextjs-toploader. Ideal when you need explicit control without relying solely on framework routing events.
Built with ❤️ by Harry Mate. 🌟 If you find this library helpful, consider dropping a Star on GitHub and following me (@harrymate22) for more open-source tools!
MIT © harrymate22
FAQs
A lightweight modern top loading progress bar for React
The npm package react-top-progress receives a total of 10 weekly downloads. As such, react-top-progress popularity was classified as not popular.
We found that react-top-progress demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.