question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Page loading progress bar (nprogress)

See original GitHub issue

Usage example, including component/hook API

Can be used to indicate that something is loading. See for example nprogress or react-top-loading-bar

Possible implementation – describe how the feature can be implemented

Should probably use the existing Progress component when implementing this.

I’m not 100% sure what the best way to implement this would be. Perhaps a hook:

const App = () => {
  const { start, stop, increment, ProgressBar }= useProgressBar({
    color: "pink",
  })

  return (
    <div>
      <ProgressBar />
      <Button onClick={start}>Load</Button>
      <Button onClick={end}>Finish</Button>
    </div>
  )
}

Do you want to contribute this feature and create a pull request

Yes

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
AlbertBronskycommented, Jan 23, 2022

@elmaxe @rtivital Any progress (no pun intended) on this? 😃

1reaction
rtivitalcommented, Jan 3, 2022

Thanks for feature request, it’s a good feature that should be added as a new package @mantine/nprogress, with this implementation:

  • Provider component
import { NProgressProvider } from '@mantine/nprogress';
import { MantineProvider } from '@mantine/core';

export function App() {
  return (
    <MantineProvider>
      <NProgressProvider color="red" size={15}>
        <AppItself />
      </NProgressProvider>
    </MantineProvider>
  );
}
  • consumer component
const Consumer = () => {
  // hook can override options defined on Provider, options are not required
  const { start, stop, set }= useNProgress({ size: 5, color: 'blue' });

  return (
    <>
      <Button onClick={start}>Load</Button>
      <Button onClick={() => set(30)}>Set 30</Button>
      <Button onClick={end}>Finish</Button>
    </>
  )
}

Do you want to work on this package?

Read more comments on GitHub >

github_iconTop Results From Across the Web

NProgress.js to show progress of page loading - Stack Overflow
I am unable to find any documentation or an easy way to add this loading effect on page load and have it finish...
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 >
rstacruz/nprogress: For slim progress bars like on ... - GitHub
Incrementing: To increment the progress bar, just use .inc() . This increments it with a random amount. This will never get to 100%:...
Read more >
useLoadingBar – A Custom React Hook for Rendering a Page ...
NProgress is a popular slim progress bar library that mimics the behavior of mobile browsers as they load content from a site. The...
Read more >
How to build a progress bar indicator in Next.js - LogRocket Blog
Learn how to use Next.js Router events to create a progress bar indicator and then customize the loader with styling and animation.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found