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.

💡 Proposal - Progress/Loading state button

See original GitHub issue

Forma 36 contribution proposal

Currently working on a custom app, where it has a button to create a new piece of content onClick.

When the onClick happens its field input data from microservices and other locations.

During this time I wanted to have a loading/progress state So I thought i would modify an

https://user-images.githubusercontent.com/739061/145859920-02fa39ff-8d02-4fa9-9143-abb8a26ddf18.mov

Some example code… I’m setting the progress bar with in state being bumped along inside an async function call (There’s probably a better way to do this) 😃

<div className="btn-container">
  <button className="btn-wrapper" onClick={createBrochure}>
    <div className="btn">
      Creating <Spinner color="white" />
    </div>
    <div className="progress" style={{ width: loadingBtn }}></div>
  </button>
</div>
.btn-container {
  position: relative;
  width: 148px;
}

.btn-wrapper {
  background-color: #036fe3;
  background-size: 100% 200%;
  border: .0625rem solid #036fe3;
  border-radius: 6px;
  box-shadow: 0 1px 0 rgba(25,37,50,.1);
  box-sizing: border-box;
  display: inline-block;
  font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
  font-size: .875rem;
  font-weight: 500;
  height: 2.5rem;
  overflow: hidden;
  padding: 0;
  text-decoration: none;
  transition: background .1s ease-in-out,opacity .2s ease-in-out,border-color .2s ease-in-out;
  vertical-align: middle;
  color: white;
  width: 100%;
  cursor: pointer;
}

.btn-wrapper .btn {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  line-height: 39px;
  text-align: center;
  z-index: 10;
  opacity: 1;
}

.btn-wrapper .progress {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  width: 50%;
  z-index: 5;
  background: #0059C8;
  border-radius: 6px;
  transition: width 2s ease-in-out;
}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
damanncommented, Dec 14, 2021

@imshuffling I really liked your idea of the button filling up. I wanted to provide some guidance around how to choose one of the two options.

1reaction
damanncommented, Dec 14, 2021

I think it’s great to have more distinguished ways of indicating ongoing processes.

I’d like to suggest a few usage guidelines:

If we (roughly) know the duration: < 10 sec, use the bouncy dots loop

10 sec, use the percentage bar For processes that take longer than 10 sec. show an estimate of when the process will be finished, ideally as time otherwise in percentage (design tbd @domarku I’d like to get your perspective here). If we don’t know the duration, provide additional context alongside the progress indicator.

Another piece of advice – that we don’t have a pattern for yet – is to allow processes to run in the background.

Don’t mix dots and percentage bars (as in the video)

Read more comments on GitHub >

github_iconTop Results From Across the Web

When You Need to Show a Button's Loading State
A progress button gives users a visual cue that indicates a loading state. When users see a process taking place, they're less likely...
Read more >
Add loading spinner to Button · Issue #3254 · carbon ... - GitHub
Add a loading spinner to the current Carbon button component to indicate that the action that resulted from the button click is still...
Read more >
Dynamic Progress Bar within the Label's Button 💡
A progress bar can be created by concatenating X number of Rectangle() you would need… Concatenate(Rectangle(),Rectangle()) => Progress Bar.
Read more >
Loading Buttons - Examples & Tutorials. Learn how to use ...
A UI concept which merges loading indicators into the action that invoked them. Primarily intended for use with forms where it gives users...
Read more >
Is it a good idea to show progress indicator inside a button?
Your button should have 3 phases if you plan on using the Progress indicator inside. Static; Progress; Success or Failure.
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