Prijeđi na glavni sadržaj Prijeđi na navigaciju dokumentima
Check
in English

Vrtilice

Označite stanje učitavanja komponente ili stranice pomoću Bootstrap spinnera, koji su u potpunosti izrađeni s HTML-om, CSS-om i bez JavaScripta.

Oko

Bootstrap "spinners" mogu se koristiti za prikaz stanja učitavanja u vašim projektima. Izrađeni su samo pomoću HTML-a i CSS-a, što znači da vam za njihovu izradu nije potreban JavaScript. Međutim, trebat će vam prilagođeni JavaScript za promjenu njihove vidljivosti. Njihov izgled, poravnanje i veličina mogu se jednostavno prilagoditi našim nevjerojatnim klasama korisnosti.

U svrhu pristupačnosti, svaki učitavač ovdje uključuje role="status"i ugniježđeni <span class="visually-hidden">Loading...</span>.

Učinak animacije ove komponente ovisi o prefers-reduced-motionmedijskom upitu. Pogledajte odjeljak smanjenog kretanja u našoj dokumentaciji o pristupačnosti .

Rubni spiner

Upotrijebite rubne točkove za lagani indikator utovara.

Učitavam...
html
<div class="spinner-border" role="status">
  <span class="visually-hidden">Loading...</span>
</div>

Boje

Obrubni spinner koristi currentColorza svoje border-color, što znači da možete prilagoditi boju pomoću uslužnih programa za boju teksta . Možete koristiti bilo koji od naših uslužnih programa za boju teksta na standardnom spineru.

Učitavam...
Učitavam...
Učitavam...
Učitavam...
Učitavam...
Učitavam...
Učitavam...
Učitavam...
html
<div class="spinner-border text-primary" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-border text-secondary" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-border text-success" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-border text-danger" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-border text-warning" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-border text-info" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-border text-light" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-border text-dark" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
Zašto ne koristiti border-colorpomoćne programe? Svaki graničnik određuje transparentgranicu za barem jednu stranu, tako da .border-{color}bi uslužni programi to nadjačali.

Rastuća vrtača

Ako vam se ne sviđa rubni spinner, prijeđite na grow spinner. Iako se tehnički ne vrti, opetovano raste!

Učitavam...
html
<div class="spinner-grow" role="status">
  <span class="visually-hidden">Loading...</span>
</div>

Još jednom, ovaj spinner napravljen je s currentColor, tako da možete jednostavno promijeniti njegov izgled pomoću uslužnih programa za boju teksta . Ovdje je u plavoj boji, zajedno s podržanim varijantama.

Učitavam...
Učitavam...
Učitavam...
Učitavam...
Učitavam...
Učitavam...
Učitavam...
Učitavam...
html
<div class="spinner-grow text-primary" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow text-secondary" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow text-success" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow text-danger" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow text-warning" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow text-info" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow text-light" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow text-dark" role="status">
  <span class="visually-hidden">Loading...</span>
</div>

Poravnanje

Spineri u Bootstrapu izgrađeni su pomoću rems currentColor, i display: inline-flex. To znači da im se lako može promijeniti veličina, boja i brzo poravnati.

Margina

Upotrijebite pomoćne alate za margine kao što .m-5je jednostavno razmak.

Učitavam...
html
<div class="spinner-border m-5" role="status">
  <span class="visually-hidden">Loading...</span>
</div>

Plasman

Upotrijebite pomoćne programe flexbox , pomoćne programe za lebdenje ili pomoćne programe za poravnanje teksta kako biste postavili spinnere točno tamo gdje ih trebate u bilo kojoj situaciji.

Savijati

Učitavam...
html
<div class="d-flex justify-content-center">
  <div class="spinner-border" role="status">
    <span class="visually-hidden">Loading...</span>
  </div>
</div>
Učitavam...
html
<div class="d-flex align-items-center">
  <strong>Loading...</strong>
  <div class="spinner-border ms-auto" role="status" aria-hidden="true"></div>
</div>

plovci

Učitavam...
html
<div class="clearfix">
  <div class="spinner-border float-end" role="status">
    <span class="visually-hidden">Loading...</span>
  </div>
</div>

Poravnanje teksta

Učitavam...
html
<div class="text-center">
  <div class="spinner-border" role="status">
    <span class="visually-hidden">Loading...</span>
  </div>
</div>

Veličina

Add .spinner-border-sm and .spinner-grow-sm to make a smaller spinner that can quickly be used within other components.

Loading...
Loading...
html
<div class="spinner-border spinner-border-sm" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow spinner-grow-sm" role="status">
  <span class="visually-hidden">Loading...</span>
</div>

Or, use custom CSS or inline styles to change the dimensions as needed.

Loading...
Loading...
html
<div class="spinner-border" style="width: 3rem; height: 3rem;" role="status">
  <span class="visually-hidden">Loading...</span>
</div>
<div class="spinner-grow" style="width: 3rem; height: 3rem;" role="status">
  <span class="visually-hidden">Loading...</span>
</div>

Buttons

Use spinners within buttons to indicate an action is currently processing or taking place. You may also swap the text out of the spinner element and utilize button text as needed.

html
<button class="btn btn-primary" type="button" disabled>
  <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
  <span class="visually-hidden">Loading...</span>
</button>
<button class="btn btn-primary" type="button" disabled>
  <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
  Loading...
</button>
html
<button class="btn btn-primary" type="button" disabled>
  <span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
  <span class="visually-hidden">Loading...</span>
</button>
<button class="btn btn-primary" type="button" disabled>
  <span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
  Loading...
</button>

CSS

Variables

Added in v5.2.0

As part of Bootstrap’s evolving CSS variables approach, spinners now use local CSS variables on .spinner-border and .spinner-grow for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

Varijable graničnog spinnera:

  --#{$prefix}spinner-width: #{$spinner-width};
  --#{$prefix}spinner-height: #{$spinner-height};
  --#{$prefix}spinner-vertical-align: #{$spinner-vertical-align};
  --#{$prefix}spinner-border-width: #{$spinner-border-width};
  --#{$prefix}spinner-animation-speed: #{$spinner-animation-speed};
  --#{$prefix}spinner-animation-name: spinner-border;
  

Rastuće varijable spinnera:

  --#{$prefix}spinner-width: #{$spinner-width};
  --#{$prefix}spinner-height: #{$spinner-height};
  --#{$prefix}spinner-vertical-align: #{$spinner-vertical-align};
  --#{$prefix}spinner-animation-speed: #{$spinner-animation-speed};
  --#{$prefix}spinner-animation-name: spinner-grow;
  

Za oba spinnera, male klase modifikatora spinnera koriste se za ažuriranje vrijednosti ovih CSS varijabli prema potrebi. Na primjer, .spinner-border-smklasa radi sljedeće:

  --#{$prefix}spinner-width: #{$spinner-width-sm};
  --#{$prefix}spinner-height: #{$spinner-height-sm};
  --#{$prefix}spinner-border-width: #{$spinner-border-width-sm};
  

Sass varijable

$spinner-width:           2rem;
$spinner-height:          $spinner-width;
$spinner-vertical-align:  -.125em;
$spinner-border-width:    .25em;
$spinner-animation-speed: .75s;

$spinner-width-sm:        1rem;
$spinner-height-sm:       $spinner-width-sm;
$spinner-border-width-sm: .2em;

Ključni okviri

Koristi se za izradu CSS animacija za naše spinnere. Uključeno u scss/_spinners.scss.

@keyframes spinner-border {
  to { transform: rotate(360deg) #{"/* rtl:ignore */"}; }
}
@keyframes spinner-grow {
  0% {
    transform: scale(0);
  }
  50% {
    opacity: 1;
    transform: none;
  }
}