Add NProgress component
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Summary 💡
Provide a component to display a progress bar with Next.js, Gatsby, etc.
Examples 🌈
import * as React from 'react';
import NProgressBar from '@material-ui/core/NProgressBar';
Router.onRouteChangeStart = () => {
NProgress.start();
};
Router.onRouteChangeComplete = () => {
NProgress.done();
};
Router.onRouteChangeError = () => {
NProgress.done();
};
function AppFrame(props) {
return (
<NProgressBar />
)
}
Motivation 🔦
On Chrome mobile, a progress bar is displayed by default. On Chrome desktop, no progress bars are displayed. However, a number of popular websites are using an approach similar to Next.js and Gatsby. You can find YouTube 32B sessions/month, Facebook 25B sessions/month.
As it turns out, we already have this component available under @material-ui/docs/NProgressBar
and use it for our documentation. We could introduce this component in the lab, with a couple of improvements, and kill the docs npm package. The improvements we could bring:
- Remove the dependency on nprogress, the logic is short and simple
- To account for the difference of behavior between mobile (chrome) and desktop: we could only display the progress bar on desktop after an initial 300ms? delay, to avoid unnecessary distractions for pages that load fast. It would also better match the expected experience of end-users on desktop. https://nextjs.org/ has a very similar behavior.
Benchmark
- https://github.com/mui-org/material-ui/blob/next/packages/material-ui-docs/src/NProgressBar/NProgressBar.js
- https://github.com/vercel/next.js/tree/canary/examples/with-loading
- https://github.com/connor-baer/bamboo-ui/blob/e45c96fe3d4dd9276b60d30eea9be935c2b66cd7/src/components/LoadingBar/LoadingBar.js
- https://mantine.dev/others/nprogress/
Issue Analytics
- State:
- Created 3 years ago
- Reactions:44
- Comments:15 (6 by maintainers)
Top Results From Across the Web
rstacruz/nprogress: For slim progress bars like on ... - GitHub
Add progress to your Ajax calls! Bind it to the jQuery ajaxStart and ajaxStop events. Make a fancy loading bar even without Turbolinks/Pjax!...
Read more >NProgress: slim progress bars in JavaScript - Rico Sta. Cruz
A nanoscopic progress bar. Featuring realistic trickle animations to convince your users that something is happening! NProgress.start() — shows the progress bar.
Read more >How to add routing loader using nprogress in Next.js? - DEV ...
Today, using the router in Next.js, I'll show you how you can create a page loader that shows a progress bar while we...
Read more >The comprehensive guide to use NProgress in Next.js [easy ...
Add NProgress to your Next.js project. To use Nprogress in your Next.js project, we first need to Navigate to our project and: Install...
Read more >nprogress | Yarn - Package Manager
#93 - Remove jQuery dependency in component (@slang800); #120 - Fix the Readme showing a wrong example for ease (@teeceepee) ... yarn add...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @bryantobing12,
Yes, the NProgress component is not available on MUI. I was the initial responsible for it but its development was frozen.
I’m currently not working with MUI so I can’t really invest time on it. If you’re interested, you can continue it.
@italodeandra the source of truth of the transition is in https://translate.material-ui.com. Your changes will be lost. I wouldn’t encourage to care, for now.