Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature-Request] Add "loading" prop to Buttons #1160

Closed
CurrentlyNoName opened this issue Apr 9, 2021 · 3 comments
Closed

[Feature-Request] Add "loading" prop to Buttons #1160

CurrentlyNoName opened this issue Apr 9, 2021 · 3 comments
Assignees
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@CurrentlyNoName
Copy link

Hello,

PrimeVue has many features I really like, but one that is missing and some other Frameworks do have is a loading-panel in Buttons.

Like this:
image
->
image

For example, this is very useful when a button is clicked and the button should be blocked until there is an answer from a request that is triggered from the button click.

Also triggering the same event multiple times can be prevented that way.

Best regards

@glebgolov-ziosem
Copy link

glebgolov-ziosem commented Apr 14, 2021

Does it make sense to implement it as a template (e.g.: <template #loading>) inside the Button component?

In the author's case, something like:

<Button label="CLICK ME" @click="handleClick($event)">
  <template #loading>
    <i class="pi pi-spin pi-spinner p-text-center"></i>
  </template>
</Button>

@cagataycivici cagataycivici self-assigned this Apr 14, 2021
@cagataycivici cagataycivici added the Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add label Apr 14, 2021
@cagataycivici cagataycivici added this to the 3.4.0 milestone Apr 14, 2021
@Zaaaoo
Copy link

Zaaaoo commented Apr 15, 2021

We already can perform this with a computed icon :

spinnerComputed(): string {
  let icon = ''

  if (this.loading) icon = 'pi pi-spin pi-spinner'
  else icon = 'pi pi-check-square'

  return icon
},

And

<Button label="Valid" :icon="spinnerComputed" />

@saenq
Copy link

saenq commented Apr 15, 2024

worked well for me
<Button :label="!loading ? 'CLICK ME' : ''" :icon="loading ? 'pi pi-spin pi-spinner' : ''"/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

No branches or pull requests

5 participants