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.

Introduce `loading` prop for buttons

See original GitHub issue

Is your feature request related to a problem? Please describe…

If a user clicks a button that triggers a long async action, there is no easy way to provide feedback.

Describe the solution you’d like

I would like to set a loading state on a button, that can be enabled/disabled by setting a ‘loading’ prop. Enabling the loading prop will automatically show a loading indicator on the button (prepend before the label?) and disable the button from further user action.

Describe alternatives you’ve considered

We can use the spinner in combination with a button and some additional setting to get the same result, but this feels verbose.

Additional context

Perhaps other actionable elements can also receive the loading prop.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
tmorehousecommented, Mar 11, 2020

One could simple v-if a <b-spinner> in a <b-button>, and then the user would have complete control of where the loading spinner is placed, what loading spinner (or feedback) they want, etc.

<b-button :disabled="busy">
  <b-spinner :class="busy ? 'invisible' : null"></b-spinner>
  <span v-if="busy">Loading...</span>
  <span v-if="!busy">Not loading</span>
</b-button>

An alternative, when v2.7.0 is released you could wrap the <b-button> with the new <b-overlay> component for an even fancier loading button.

<b-overlay :show="busy" rounded class="d-inline-block">
  <b-button :disabled="busy">Do something</b-button>
</b-overlay>

image

See https://bootstrap-vue.netlify.com/docs/components/overlay for a preview of 2.7.0

2reactions
tmorehousecommented, Mar 14, 2020

BootstrapVue 2.7.0 has been released, with the new <b-overlay> component.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Loading Button Component - CoreUI
React Loading Button Component. Buttons with built-in loading indicators. Indicate the loading state of the button bridging the gap between action and feedback....
Read more >
How to: Asynchronous buttons with loading state in React ...
All we have to do to make our button asynchronous is re-implement its onClick event. const Button = (props) => { ...
Read more >
React Material UI Tutorial - 39 - Loading Button - YouTube
Courses - https://learn.codevolution.dev/ Support - https://www.paypal.me/Codevolution Github - https://github.com/gopinav⚡️ Checkout ...
Read more >
React Suite Loading Button - GeeksforGeeks
React Suite Button Loading Props: loading: It is a boolean property of the Button component used to show a loading button. color: This...
Read more >
Creating a nice loading button with React Hooks - humbledev
Tutorial showing how to create a loading button with React Hooks.
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