Spinners
Nunjukkeun kaayaan loading komponén atawa kaca kalawan Bootstrap spinners, diwangun sagemblengna kalawan HTML, CSS, sarta euweuh JavaScript.
Ngeunaan
Bootstrap "spinners" tiasa dianggo pikeun nunjukkeun kaayaan loading dina proyék anjeun. Éta ngan ukur diwangun ku HTML sareng CSS, hartosna anjeun henteu peryogi JavaScript pikeun nyiptakeunana. Anjeun bakal kitu, perlu sababaraha custom JavaScript mun toggle pisibilitas maranéhanana. Penampilan, alignment, sareng ukuranana tiasa gampang disaluyukeun sareng kelas utiliti anu luar biasa.
Pikeun tujuan aksesibilitas, unggal loader di dieu ngawengku role="status"
na nested <span class="sr-only">Loading...</span>
.
prefers-reduced-motion
pamundut média. Tempo
bagian gerak ngurangan tina dokuméntasi aksés kami .
Spinner wates
Paké spinners wates pikeun indikator loading lightweight.
<div class="spinner-border" role="status">
<span class="sr-only">Loading...</span>
</div>
Warna-warna
Spinner wates ngagunakeun currentColor
pikeun na border-color
, hartina anjeun bisa ngaluyukeun warna jeung utilitas warna téks . Anjeun tiasa nganggo salah sahiji utilitas warna téks kami dina spinner standar.
<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>
border-color
utiliti? Unggal spinner wates nangtukeun
transparent
wates pikeun sahanteuna hiji sisi, jadi
.border-{color}
Utiliti bakal override éta.
Tumuwuh spinner
Mun anjeun teu fancy a spinner wates, pindah ka spinner tumuwuh. Sanaos sacara téknisna henteu spin, éta sababaraha kali tumuwuh!
<div class="spinner-grow" role="status">
<span class="sr-only">Loading...</span>
</div>
Sakali deui, spinner ieu diwangun ku currentColor
, sangkan anjeun bisa kalayan gampang ngarobah penampilan na kalawan Utiliti warna téks . Ieu mangrupikeun warna biru, sareng varian anu dirojong.
<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>
Ngajajar
Spinners di Bootstrap diwangun ku rem
s,, currentColor
jeung display: inline-flex
. Ieu ngandung harti yén maranéhna bisa kalayan gampang jadi ukuranana, recolored, sarta gancang Blok.
Margin
Anggo utilitas margin sapertos .m-5
pikeun jarak anu gampang.
<div class="spinner-border m-5" role="status">
<span class="sr-only">Loading...</span>
</div>
panempatan
Anggo utiliti flexbox , utilitas float , atanapi utilitas alignment téks pikeun nempatkeun spinners dimana anjeun peryogina dina kaayaan naon waé.
Flex
<div class="d-flex justify-content-center">
<div class="spinner-border" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
<div class="d-flex align-items-center">
<strong>Loading...</strong>
<div class="spinner-border ml-auto" role="status" aria-hidden="true"></div>
</div>
Ngapung
<div class="clearfix">
<div class="spinner-border float-right" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
Teks ngajajar
<div class="text-center">
<div class="spinner-border" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
Ukuran
Tambahkeun .spinner-border-sm
tur .spinner-grow-sm
nyieun spinner leutik nu bisa gancang dipaké dina komponén séjén.
<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>
Atanapi, paké CSS khusus atanapi gaya inline pikeun ngarobih dimensi upami diperyogikeun.
<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>
Kancing
Anggo spinners dina tombol pikeun nunjukkeun yén tindakan ayeuna nuju diolah atanapi lumangsung. Anjeun oge bisa ngaganti téks kaluar tina unsur spinner sarta ngagunakeun tombol téks sakumaha diperlukeun.
<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>