-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[button] Add spinner/loading theme variant #842
Comments
After vaadin/vaadin-button#112 is fixed, the spinner/loading variant should look like close to this: |
In our v8 apps we have used this quite heavily for long running operations in combination with To customize the icon and e.g. loading Text I would propose to add additional APIs for:
This could also be done with a new method |
Probably not the best looking solution, but if somebody needs it: v22+ The style is automatically applied if the button is configured with :host([disableonclick][disabled]) {
color: transparent;
}
:host([disableonclick][disabled]) [part='label']::after {
content: "";
position: absolute;
width: 16px;
height: 16px;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
border: 4px solid transparent;
border-top-color: red;
border-radius: 50%;
animation: button-loading-spinner 1s ease infinite;
}
@keyframes button-loading-spinner {
from {
transform: rotate(0turn);
}
to {
transform: rotate(1turn);
}
} |
Relevant article for technical design and a11y: https://adrianroselli.com/2021/01/multi-function-button.html |
Nice feature to have in Vaadin |
The framework usually automatically displays a loading indicator from the start of a server request and hides it after the response processing has ended. However, in case the backend handles the action asynchronously, the loading indicator is not shown and in this case the UI remains otherwise active while the action is still in progress. Tatu Lund has created an asynchronous button click handler example here: As you can see, even though there is a spinner in the middle of the screen, the button state does not change and it does not contain the spinner, so the user can continue clicking on it, which is not ideal. Adding a spinner button theme variant would be really great for this case. |
Add a theme variant for a disabled button, to give users an indication that the action the button triggered is being performed.
Should be added for both Lumo and Material themes.
The text was updated successfully, but these errors were encountered: