diff --git a/package.json b/package.json index 29665aa4ae19..a91e04f9fdeb 100644 --- a/package.json +++ b/package.json @@ -178,7 +178,7 @@ }, { "path": "./dist/css/bootstrap.min.css", - "maxSize": "22 kB" + "maxSize": "22.5 kB" }, { "path": "./dist/js/bootstrap.bundle.js", diff --git a/scss/_spinners.scss b/scss/_spinners.scss new file mode 100644 index 000000000000..edf70d9fbe2e --- /dev/null +++ b/scss/_spinners.scss @@ -0,0 +1,63 @@ +// +// Rotating border +// + +@keyframes spinner-border { + to { transform: rotate(360deg); } +} + +.spinner-border { + position: relative; + display: inline-block; + width: $spinner-width; + height: $spinner-height; + overflow: hidden; + text-indent: -999em; + vertical-align: text-bottom; + border: $spinner-border-width solid; + border-color: currentColor transparent currentColor currentColor; + border-radius: 50%; + animation: spinner-border .75s linear infinite; +} + +.spinner-border-sm { + width: $spinner-width-sm; + height: $spinner-height-sm; + border-width: $spinner-border-width-sm; +} + +// +// Growing circle +// + +@keyframes spinner-grow { + 0% { + opacity: 0; + transform: scale(0); + } + 50% { + opacity: 1; + } + 100% { + opacity: 0; + transform: scale(1); + } +} + +.spinner-grow { + position: relative; + display: inline-block; + width: $spinner-width; + height: $spinner-height; + overflow: hidden; + text-indent: -999em; + vertical-align: text-bottom; + background-color: currentColor; + border-radius: 50%; + animation: spinner-grow .75s linear infinite; +} + +.spinner-grow-sm { + width: $spinner-width-sm; + height: $spinner-height-sm; +} diff --git a/scss/_variables.scss b/scss/_variables.scss index dac260c19708..c636860bdadc 100644 --- a/scss/_variables.scss +++ b/scss/_variables.scss @@ -1024,6 +1024,17 @@ $carousel-transition-duration: .6s !default; $carousel-transition: transform $carousel-transition-duration ease-in-out !default; // Define transform transition first if using multiple transitions (e.g., `transform 2s ease, opacity .5s ease-out`) +// Spinners + +$spinner-width: 2rem !default; +$spinner-height: $spinner-width !default; +$spinner-border-width: .25em !default; + +$spinner-width-sm: 1rem !default; +$spinner-height-sm: $spinner-width-sm !default; +$spinner-border-width-sm: .2em !default; + + // Close $close-font-size: $font-size-base * 1.5 !default; diff --git a/scss/bootstrap.scss b/scss/bootstrap.scss index e3f76546b24a..6f7e4eef15bf 100644 --- a/scss/bootstrap.scss +++ b/scss/bootstrap.scss @@ -38,5 +38,6 @@ @import "tooltip"; @import "popover"; @import "carousel"; +@import "spinners"; @import "utilities"; @import "print"; diff --git a/site/_data/nav.yml b/site/_data/nav.yml index 14002d395155..cb0defd890f4 100644 --- a/site/_data/nav.yml +++ b/site/_data/nav.yml @@ -49,6 +49,7 @@ - title: Popovers - title: Progress - title: Scrollspy + - title: Spinners - title: Tooltips - title: Utilities diff --git a/site/docs/4.1/components/spinners.md b/site/docs/4.1/components/spinners.md new file mode 100644 index 000000000000..d1506700296c --- /dev/null +++ b/site/docs/4.1/components/spinners.md @@ -0,0 +1,159 @@ +--- +layout: docs +title: Spinners +description: Indicate the loading state of a component or page with Bootstrap spinners, built entirely with HTML, CSS, and no JavaScript. +group: components +toc: true +--- + +## About + +Bootstrap "spinners" can be used to show the loading state in your projects. They're built only with HTML and CSS, meaning you don't need any JavaScript to create them. You will, however, need some custom JavaScript to toggle their visibility. Their appearance, alignment, and sizing can be easily customized with our amazing utility classes. + +For accessibility purposes, each loader here includes `role="status"` and `Loading...` text within. We account for this in our CSS, using a text hiding technique to prevent it from rendering on screen. + +## Border spinner + +Use the border spinners for a lightweight loading indicator. + +{% capture example %} +