tobiasahlin /SpinKit
A collection of loading indicators animated with CSS
★ 19,309⑂ 1,752👁 439⑃ 94● 59▤ 9
+0
Daily
+4
Weekly
-11
Monthly
19,309
stars
1,752
forks
439
watchers
94
prs
59
issues
9
releases
README
SpinKit
Simple loading spinners animated with CSS. See demo. SpinKit only uses (transform and opacity) CSS animations to create smooth and easily customizable animations.
Usage
- Add spinkit.css or spinkit.min.css to your project (or copy-paste the CSS that you need for your spinner—there are no dependencies between spinners, no shared classes, and no shared animations, etc, so it should be fairly straight-forward to extract only the code that you need)
- Add a spinner to your project by copy-pasting HTML from spinkit.css or examples.html
- Add the sk-center utility class to the spinner to center it (it sets margin to auto)
- By default, the width and height of all spinners are set to 40px. background-color is set to 333.
- Configure the spinner by overwriting the CSS variables, primarily --sk-size (spinner width & height) and --sk-color (spinner color). If you need broader browser support, remove the CSS variables.
You can include SpinKit to your project with bower:
bash
$ bower install spinkit
or npm:
bash
$ npm install spinkit
Spinners
Given that you have included spinkit.min.css in your project, these snippets will produce the different spinners:
Plane
html
Chase
html
Bounce
html
Wave
html
Pulse
html
Flow
html
Swing
html
Circle
html
Circle Fade
html
Grid
html
Fold
html
Wander
html
Web browser compatibility
SpinKit uses CSS animations and variables:
- CSS keyframes animations are at +96.5% global support
- CSS variables are at +91.8% global support
Implementing a fallback spinner
How do you know if you need to provide a fallback? You can check for animation support with Modernizr, or manually check for the animation property, and replace the spinner with a GIF if it's not supported:
javascript
function browserSupportsCSSProperty(propertyName) {
var elm = document.createElement('div');
propertyName = propertyName.toLowerCase();
if (elm.style[propertyName] != undefined)
return true;
var propertyNameCapital = propertyName.charAt(0).toUpperCase() + propertyName.substr(1),
domPrefixes = 'Webkit Moz ms O'.split(' ');
for (var i = 0; i < domPrefixes.length; i++) {
if (elm.style[domPrefixes[i] + propertyNameCapital] != undefined)
return true;
}
return false;
}
Use it to check for animation support:
javascript
if (!browserSupportsCSSProperty('animation')) {
// fallback…
}Top issues
#136Flashing artifact when reducing the circle spinner size5 comments · 2017-08-09#160Blurry animation1 comments · 2020-09-23#151Old Browser-Support1 comments · 2020-01-16#150Reintroduce SCSS and modular structure1 comments · 2020-01-16#166Feature Request: Can this work for Dashboard-2 for Node-RED ?0 comments · 2025-06-07#161[Feature Request] Add a diamond shaped loader0 comments · 2021-04-01
Latest release
v2.0.1 v2.0.1 2019-10-30Fixes Chase HTML snippet containing too many child elements