You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add README positioning section and fix Usage snippets
The Usage snippets mounted with `render` from `react-dom`, which React 19
removed, so the first thing a new user copied threw at runtime. They now
show the component only, dropping the mount boilerplate.
Adds a "When to Use This" section covering when a drop-in router-integrated
bar is the better fit and when this package is, with a nav entry alongside
the existing sections.
[Background](#background) | [When to Use This](#when-to-use-this) | [Usage](#usage) | [Live Examples](#live-examples) | [API](#api) | [Installation](#installation) | [License](#license)
12
12
13
13
## Background
14
14
15
15
This is a React port of [rstacruz](https://github.com/rstacruz)'s [`nprogress`](https://github.com/rstacruz/nprogress) module. It exposes an API that encapsulates the logic of `nprogress` and renders nothing, allowing consumers to implement their own rendering.
16
16
17
+
## When to Use This
18
+
19
+
This package is a headless primitive. It renders no markup and ships no CSS, supplying only the pacing state: a `progress` value that trickles towards completion, an `isFinished` flag, and the `animationDuration` to transition with. The bar itself is yours to write.
20
+
21
+
- Use a drop-in bar such as [`nextjs-toploader`](https://github.com/TheSGJ/nextjs-toploader), [`next-nprogress-bar`](https://github.com/Skyleen77/next-nprogress-bar), or [`nprogress`](https://github.com/rstacruz/nprogress) itself when you want a styled bar wired up to your router with no rendering work.
22
+
- Use this package when you render the bar yourself, for example with design-system components or custom containers and spinners, and want only the trickle and completion logic handled for you.
23
+
- Use this package when you need several progress bars on one page, each tracking its own state.
24
+
17
25
## Usage
18
26
19
27
In the following examples, `Container`, `Bar` and `Spinner` are custom components.
@@ -22,8 +30,6 @@ In the following examples, `Container`, `Bar` and `Spinner` are custom component
0 commit comments