react-nprogress
A React primitive for building slim progress bars.
Background
This is a React port of rstacruz's nprogress
module. It exposes an API that encapsulates the logic of nprogress
and renders nothing, giving you complete control over rendering.
Usage
Render Props
Container
, Bar
and Spinner
are custom components. NProgress
doesn't render anything itself, it just calls the render function and renders that:
HOC
Live Examples
- Original Design: Source | Sandbox
- HOC: Source | Sandbox
- React Router: Source | Sandbox
- Reach Router: Source | Sandbox
- Next Router: Source | Sandbox
- UMD Build (Development): Source | Sandbox
- UMD Build (Production): Source | Sandbox
API
Props
animationDuration
- Optional Number indicating the animation duration inms
. Defaults to200
.incrementDuration
- Optional Number indicating the length of time between progress bar increments inms
. Defaults to800
.isAnimating
- Optional Boolean indicating if the progress bar is animating. Defaults tofalse
.minimum
- Optional Number between0
and1
indicating the minimum value of the progress bar. Defaults to0.08
.
Render Props Example
HOC Example
Installation
$ npm install @tanem/react-nprogress
There are also UMD builds available via unpkg:
- https://unpkg.com/@tanem/react-nprogress/umd/react-nprogress.development.js
- https://unpkg.com/@tanem/react-nprogress/umd/react-nprogress.production.min.js
For the non-minified development version, make sure you have already included:
For the minified production version, make sure you have already included: