Summary
Spinners are used for showing a system process of unknown length going on that ends with the system displaying results to the user.
Status
API status:
general
Included in AUI core?
Not in core
You must explicitly require the web resource key.
Web resource key:
com.atlassian.auiplugin:aui-spinner
AMD Module key:
N/A
Experimental API:
5.1
General API:
5.8
Web Component API:
7.7
Examples
Normal spinner
AUI's spinner is just an HTML element. Add it to wherever you need to indicate progress is being made.
Edit icon Edit in codepen
Split more
Example
Small spinner
Medium spinner
Large spinner
Small spinner
Medium spinner
Large spinner
Filled spinner
If you need a spinner to fit in the middle of a containing element,
add a filled
attribute to the spinner element.
Edit icon Edit in codepen
Split more
Example
Filled
Not Filled
Filled
Not Filled
Spinners in buttons
You can add a spinner to an AUI Button by setting the button's busy
property to true
.
Edit icon Edit in codepen
Split more
Example
Do Something
Do Something
Do Something
Do Something
AJS.$(function() {
AJS.$('#button-spin-1, #button-spin-2').click(function() {
if (!this.isBusy()) {
this.setAttribute('aria-disabled', 'true');
this.busy();
var that = this;
setTimeout(function() {
that.setAttribute('aria-disabled', 'false');
that.idle();
}, 2000);
}
});
});
HTML API
<aui-spinner>
Name
Attribute
Property
Type
Default
Description
size
is an attribute
is a property
Enum
medium
An Enum which provides size of the spinner.
Possible values are: small
(20px), medium
(30px) and large
(50px).
filled
is an attribute
is a property
Boolean
false
A Boolean which changes behavior of the spinner.
When present, the spinner element will be placed in the middle of the parent element and have a width and height of zero.
JavaScript API Deprecated
There are two jQuery functions available you can call on an element to add and remove a filled spinner.
Edit icon Edit in codepen
Split more
Example
Do Something
Do Something
AJS.$(function() {
var spinning = false;
AJS.$('#spinner-trigger').on('click', function() {
if (!spinning) {
AJS.$(this).text('Stop Spinning!');
AJS.$('.button-spinner').spin();
spinning = true;
} else {
AJS.$(this).text('Do Something');
AJS.$('.button-spinner').spinStop();
spinning = false;
}
});
});
Calling AJS.$(element).spin()
will append the following spinner to element
:
Calling AJS.$(element).spinStop()
will remove the spinner element.