Source

Spinner

Nuduhake status loading komponen utawa kaca nganggo pemintal Bootstrap, dibangun kanthi HTML, CSS, lan ora ana JavaScript.

Babagan

Bootstrap "spinners" bisa digunakake kanggo nuduhake status loading ing proyek sampeyan. Iki mung dibangun nganggo HTML lan CSS, tegese sampeyan ora butuh JavaScript kanggo nggawe. Nanging, sampeyan butuh JavaScript khusus kanggo ngalih visibilitas. Penampilan, keselarasan, lan ukurane bisa gampang disesuaikan karo kelas sarana sing apik tenan.

Kanggo tujuan aksesibilitas, saben loader kene kalebu role="status"lan nested <span class="sr-only">Loading...</span>.

Pemintal wates

Gunakake spinner wewatesan kanggo indikator loading entheng.

Loading...
<div class="spinner-border" role="status">
  <span class="sr-only">Loading...</span>
</div>

werna-werna

Spinner wewatesan digunakake currentColorkanggo sawijining border-color, tegese sampeyan bisa ngatur werna karo keperluan werna teks . Sampeyan bisa nggunakake sembarang keperluan werna teks ing spinner standar.

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
<div class="spinner-border text-primary" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-border text-secondary" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-border text-success" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-border text-danger" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-border text-warning" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-border text-info" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-border text-light" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-border text-dark" role="status">
  <span class="sr-only">Loading...</span>
</div>

Apa ora nggunakake border-colorutilitas? Saben spinner wewatesan nemtokake transparentwates paling sethithik sak sisih, supaya .border-{color}utilitas bakal ngatasi.

Tuwuh spinner

Yen sampeyan ora seneng spinner wewatesan, ngalih menyang spinner tuwuh. Nalika ora sacara teknis muter, bola-bali tuwuh!

Loading...
<div class="spinner-grow" role="status">
  <span class="sr-only">Loading...</span>
</div>

Sawise maneh, spinner iki dibangun karo currentColor, supaya sampeyan bisa kanthi gampang ngganti tampilan karo keperluan werna teks . Ing kene ana warna biru, bebarengan karo varian sing didhukung.

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
<div class="spinner-grow text-primary" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-grow text-secondary" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-grow text-success" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-grow text-danger" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-grow text-warning" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-grow text-info" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-grow text-light" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-grow text-dark" role="status">
  <span class="sr-only">Loading...</span>
</div>

Alignment

Spinners ing Bootstrap dibangun karo rems, currentColor, lan display: inline-flex. Iki tegese padha bisa gampang diowahi ukurane, recolored, lan cepet selaras.

Margin

Gunakake utilitas margin kaya .m-5kanggo spasi sing gampang.

Loading...
<div class="spinner-border m-5" role="status">
  <span class="sr-only">Loading...</span>
</div>

Panggonan

Gunakake utilitas flexbox , utilitas float , utawa utilitas alignment teks kanggo nyelehake spinner ing ngendi sampeyan butuh ing kahanan apa wae.

Fleksibel

Loading...
<div class="d-flex justify-content-center">
  <div class="spinner-border" role="status">
    <span class="sr-only">Loading...</span>
  </div>
</div>
Loading...
<div class="d-flex align-items-center">
  <strong>Loading...</strong>
  <div class="spinner-border ml-auto" role="status" aria-hidden="true"></div>
</div>

Ngambang

Loading...
<div class="clearfix">
  <div class="spinner-border float-right" role="status">
    <span class="sr-only">Loading...</span>
  </div>
</div>

Selarasake teks

Loading...
<div class="text-center">
  <div class="spinner-border" role="status">
    <span class="sr-only">Loading...</span>
  </div>
</div>

Ukuran

Tambah .spinner-border-smlan .spinner-grow-smnggawe spinner cilik sing bisa digunakake kanthi cepet ing komponen liyane.

Loading...
Loading...
<div class="spinner-border spinner-border-sm" role="status">
  <span class="sr-only">Loading...</span>
</div>
<div class="spinner-grow spinner-grow-sm" role="status">
  <span class="sr-only">Loading...</span>
</div>

Utawa, gunakake CSS khusus utawa gaya inline kanggo ngganti dimensi kaya sing dibutuhake.

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

Tombol

Gunakake spinners ing tombol kanggo nunjukaké tumindak lagi proses utawa njupuk Panggonan. Sampeyan uga bisa ngganti teks metu saka unsur spinner lan nggunakake tombol teks yen perlu.

<button class="btn btn-primary" type="button" disabled>
  <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
  <span class="sr-only">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>
<button class="btn btn-primary" type="button" disabled>
  <span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
  <span class="sr-only">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>