Dhaptar klompok
Grup dhaptar minangka komponen sing fleksibel lan kuat kanggo nampilake seri konten. Ngowahi lan ngluwihi kanggo ndhukung meh wae isi ing.
Klompok dhaptar sing paling dhasar yaiku dhaptar tanpa urutan karo item dhaptar lan kelas sing cocog. Mbangun ing karo opsi sing tindakake, utawa karo CSS dhewe yen perlu.
- Cras justo odio
- Dapibus ac facilisis ing
- Morbi leo risus
- Porta ac consectetur ac
- Vestibulum lan eros
<ul class="list-group">
<li class="list-group-item">Cras justo odio</li>
<li class="list-group-item">Dapibus ac facilisis in</li>
<li class="list-group-item">Morbi leo risus</li>
<li class="list-group-item">Porta ac consectetur ac</li>
<li class="list-group-item">Vestibulum at eros</li>
</ul>
Tambah .active
menyang a .list-group-item
kanggo nuduhake pilihan aktif saiki.
- Cras justo odio
- Dapibus ac facilisis ing
- Morbi leo risus
- Porta ac consectetur ac
- Vestibulum lan eros
<ul class="list-group">
<li class="list-group-item active">Cras justo odio</li>
<li class="list-group-item">Dapibus ac facilisis in</li>
<li class="list-group-item">Morbi leo risus</li>
<li class="list-group-item">Porta ac consectetur ac</li>
<li class="list-group-item">Vestibulum at eros</li>
</ul>
Tambah .disabled
menyang a .list-group-item
supaya katon dipatèni. Elinga yen sawetara unsur .disabled
uga mbutuhake JavaScript khusus kanggo mateni kabeh acara klik (contone, pranala).
- Cras justo odio
- Dapibus ac facilisis ing
- Morbi leo risus
- Porta ac consectetur ac
- Vestibulum lan eros
<ul class="list-group">
<li class="list-group-item disabled">Cras justo odio</li>
<li class="list-group-item">Dapibus ac facilisis in</li>
<li class="list-group-item">Morbi leo risus</li>
<li class="list-group-item">Porta ac consectetur ac</li>
<li class="list-group-item">Vestibulum at eros</li>
</ul>
Gunakake <a>
s utawa <button>
s kanggo nggawe item klompok dhaptar sing bisa ditindakake kanthi status hover, mateni, lan aktif kanthi nambahake .list-group-item-action
. Kita misahake kelas pseudo iki kanggo mesthekake klompok dhaptar sing digawe saka unsur non-interaktif (kaya <li>
s utawa <div>
s) ora nyedhiyakake kemampuan klik utawa tunyuk.
Priksa manawa sampeyan ora nggunakake kelas standar ing .btn
kene .
<div class="list-group">
<a href="#" class="list-group-item list-group-item-action active">
Cras justo odio
</a>
<a href="#" class="list-group-item list-group-item-action">Dapibus ac facilisis in</a>
<a href="#" class="list-group-item list-group-item-action">Morbi leo risus</a>
<a href="#" class="list-group-item list-group-item-action">Porta ac consectetur ac</a>
<a href="#" class="list-group-item list-group-item-action disabled">Vestibulum at eros</a>
</div>
Kanthi <button>
s, sampeyan uga bisa nggunakake disabled
atribut tinimbang .disabled
kelas. Susah, <a>
s ora ndhukung atribut dipatèni.
<div class="list-group">
<button type="button" class="list-group-item list-group-item-action active">
Cras justo odio
</button>
<button type="button" class="list-group-item list-group-item-action">Dapibus ac facilisis in</button>
<button type="button" class="list-group-item list-group-item-action">Morbi leo risus</button>
<button type="button" class="list-group-item list-group-item-action">Porta ac consectetur ac</button>
<button type="button" class="list-group-item list-group-item-action" disabled>Vestibulum at eros</button>
</div>
Tambah .list-group-flush
kanggo mbusak sawetara wates lan sudhut dibunderaké kanggo nerjemahake dhaftar item klompok pinggiran-kanggo-pinggiran ing wadhah induk (contone, kertu).
- Cras justo odio
- Dapibus ac facilisis ing
- Morbi leo risus
- Porta ac consectetur ac
- Vestibulum lan eros
<ul class="list-group list-group-flush">
<li class="list-group-item">Cras justo odio</li>
<li class="list-group-item">Dapibus ac facilisis in</li>
<li class="list-group-item">Morbi leo risus</li>
<li class="list-group-item">Porta ac consectetur ac</li>
<li class="list-group-item">Vestibulum at eros</li>
</ul>
Gunakake kelas kontekstual kanggo gaya item dhaptar kanthi latar mburi stateful lan werna.
- Dapibus ac facilisis ing
- Iki minangka item klompok dhaptar utama
- Iki minangka item klompok dhaptar sekunder
- Iki minangka item grup dhaptar sukses
- Iki minangka item klompok dhaptar bebaya
- Iki minangka item klompok dhaptar bebaya
- Iki minangka item grup dhaptar info
- Iki minangka item klompok dhaptar sing entheng
- Iki minangka item klompok dhaptar peteng
<ul class="list-group">
<li class="list-group-item">Dapibus ac facilisis in</li>
<li class="list-group-item list-group-item-primary">This is a primary list group item</li>
<li class="list-group-item list-group-item-secondary">This is a secondary list group item</li>
<li class="list-group-item list-group-item-success">This is a success list group item</li>
<li class="list-group-item list-group-item-danger">This is a danger list group item</li>
<li class="list-group-item list-group-item-warning">This is a warning list group item</li>
<li class="list-group-item list-group-item-info">This is a info list group item</li>
<li class="list-group-item list-group-item-light">This is a light list group item</li>
<li class="list-group-item list-group-item-dark">This is a dark list group item</li>
</ul>
Kelas kontekstual uga bisa digunakake karo .list-group-item-action
. Elinga tambahan gaya hover ing kene ora ana ing conto sadurunge. Uga didhukung yaiku .active
negara; aplikasi iku kanggo nunjukaké pilihan aktif ing item klompok dhaftar kontekstual.
<div class="list-group">
<a href="#" class="list-group-item list-group-item-action">Dapibus ac facilisis in</a>
<a href="#" class="list-group-item list-group-item-action list-group-item-primary">This is a primary list group item</a>
<a href="#" class="list-group-item list-group-item-action list-group-item-secondary">This is a secondary list group item</a>
<a href="#" class="list-group-item list-group-item-action list-group-item-success">This is a success list group item</a>
<a href="#" class="list-group-item list-group-item-action list-group-item-danger">This is a danger list group item</a>
<a href="#" class="list-group-item list-group-item-action list-group-item-warning">This is a warning list group item</a>
<a href="#" class="list-group-item list-group-item-action list-group-item-info">This is a info list group item</a>
<a href="#" class="list-group-item list-group-item-action list-group-item-light">This is a light list group item</a>
<a href="#" class="list-group-item list-group-item-action list-group-item-dark">This is a dark list group item</a>
</div>
Nuduhake makna kanggo teknologi assistive
Nggunakake warna kanggo nambah makna mung menehi indikasi visual, sing ora bakal dikirim menyang pangguna teknologi bantu - kayata pembaca layar. Priksa manawa informasi sing dituduhake kanthi warna katon jelas saka isi kasebut (umpamane teks sing katon), utawa kalebu liwat cara alternatif, kayata teks tambahan sing didhelikake karo .sr-only
kelas.
Tambah lencana menyang item klompok dhaptar kanggo nuduhake jumlah sing durung diwaca, kegiatan, lan liya-liyane kanthi bantuan sawetara utilitas .
- Cras justo odio14
- Dapibus ac facilisis ing2
- Morbi leo risus1
<ul class="list-group">
<li class="list-group-item d-flex justify-content-between align-items-center">
Cras justo odio
<span class="badge badge-primary badge-pill">14</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
Dapibus ac facilisis in
<span class="badge badge-primary badge-pill">2</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
Morbi leo risus
<span class="badge badge-primary badge-pill">1</span>
</li>
</ul>
Tambahake meh kabeh HTML ing, sanajan kanggo grup dhaptar sing disambung kaya ing ngisor iki, kanthi bantuan flexbox utilities .
Dhaptar judhul item klompok
3 dina kepungkurDonec id elit non mi porta gravida lan eget metus. Maecenas sed diam eget risus varius blandit.
Donec id elit non mi porta.Dhaptar judhul item klompok
3 dina kepungkurDonec id elit non mi porta gravida lan eget metus. Maecenas sed diam eget risus varius blandit.
Donec id elit non mi porta.Dhaptar judhul item klompok
3 dina kepungkurDonec id elit non mi porta gravida lan eget metus. Maecenas sed diam eget risus varius blandit.
Donec id elit non mi porta.<div class="list-group">
<a href="#" class="list-group-item list-group-item-action flex-column align-items-start active">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">List group item heading</h5>
<small>3 days ago</small>
</div>
<p class="mb-1">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
<small>Donec id elit non mi porta.</small>
</a>
<a href="#" class="list-group-item list-group-item-action flex-column align-items-start">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">List group item heading</h5>
<small class="text-muted">3 days ago</small>
</div>
<p class="mb-1">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
<small class="text-muted">Donec id elit non mi porta.</small>
</a>
<a href="#" class="list-group-item list-group-item-action flex-column align-items-start">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">List group item heading</h5>
<small class="text-muted">3 days ago</small>
</div>
<p class="mb-1">Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.</p>
<small class="text-muted">Donec id elit non mi porta.</small>
</a>
</div>
Gunakake plugin JavaScript tab-kalebu kanthi individu utawa liwat bootstrap.js
file sing dikompilasi-kanggo nggedhekake grup dhaptar kita kanggo nggawe panel tabable isi lokal.
Sampeyan bisa ngaktifake pandhu arah klompok dhaptar tanpa nulis JavaScript kanthi mung nemtokake data-toggle="list"
utawa ing unsur. Gunakake atribut data iki ing .list-group-item
.
Aktifake item dhaptar tab liwat JavaScript (saben item dhaptar kudu diaktifake kanthi individu):
Sampeyan bisa ngaktifake item dhaptar individu kanthi sawetara cara:
Kanggo nggawe panel tab luntur, tambahake .fade
saben .tab-pane
. Panel tab pisanan uga kudu .show
nggawe konten awal katon.
Ngaktifake unsur item dhaptar lan wadhah konten. Tab kudu duwe data-target
utawa href
nargetake simpul wadhah ing DOM.
Milih item dhaptar sing diwenehake lan nuduhake panel sing gegandhengan. Item dhaptar liyane sing sadurunge dipilih dadi ora dipilih lan panel sing gegandhengan didhelikake. Bali menyang panelpon sadurunge panel tab wis bener ditampilake (contone, sadurunge shown.bs.tab
acara kedadeyan).
Nalika nuduhake tab anyar, acara kasebut murub kanthi urutan ing ngisor iki:
hide.bs.tab
(ing tab aktif saiki)show.bs.tab
(ing tab sing bakal ditampilake)hidden.bs.tab
(ing tab aktif sadurunge, padha karohide.bs.tab
acara kasebut)shown.bs.tab
(ing tab sing mentas aktif ditampilake, padha karoshow.bs.tab
acara kasebut)
Yen ora ana tab sing wis aktif, acara hide.bs.tab
lan hidden.bs.tab
ora bakal dipecat.
Jenis acara | Katrangan |
---|---|
show.bs.tab | Acara iki murub ing tab show, nanging sadurunge tab anyar wis ditampilake. Gunakake event.target lan event.relatedTarget kanggo target tab aktif lan tab aktif sadurunge (yen kasedhiya). |
ditampilake.bs.tab | Acara iki murub ing tab show sawise tab ditampilake. Gunakake event.target lan event.relatedTarget kanggo target tab aktif lan tab aktif sadurunge (yen kasedhiya). |
hide.bs.tab | Acara iki murub nalika tab anyar bakal ditampilake (lan kanthi mangkono tab aktif sadurunge bakal didhelikake). Gunakake event.target lan event.relatedTarget kanggo target tab aktif saiki lan tab anyar sing bakal aktif. |
hidden.bs.tab | Acara iki murub sawise tab anyar ditampilake (lan kanthi mangkono tab aktif sadurunge didhelikake). Gunakake event.target lan event.relatedTarget kanggo target tab aktif sadurunge lan tab aktif anyar, mungguh. |