Kundi la orodha
Vikundi vya orodha ni sehemu inayoweza kunyumbulika na yenye nguvu ya kuonyesha mfululizo wa maudhui. Zirekebishe na zipanue ili kusaidia takriban maudhui yoyote ndani.
Kundi la msingi zaidi la orodha ni orodha isiyo na mpangilio iliyo na vitu vya orodha na madarasa sahihi. Jenga juu yake na chaguo zinazofuata, au na CSS yako mwenyewe inavyohitajika.
- Cras justo odio
- Dapibus ac kuwezesha katika
- Morbi leo rius
- Porta ac consectetur ac
- Vestibulum na 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>
Ongeza .active
kwa a .list-group-item
ili kuonyesha uteuzi unaotumika sasa.
- Cras justo odio
- Dapibus ac kuwezesha katika
- Morbi leo rius
- Porta ac consectetur ac
- Vestibulum na 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>
Ongeza .disabled
kwa a .list-group-item
ili kuifanya ionekane kuwa imezimwa. Kumbuka kwamba baadhi ya vipengele vilivyo na .disabled
pia vitahitaji JavaScript maalum ili kuzima kikamilifu matukio yao ya kubofya (kwa mfano, viungo).
- Cras justo odio
- Dapibus ac kuwezesha katika
- Morbi leo rius
- Porta ac consectetur ac
- Vestibulum na 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>
Tumia <a>
s au <button>
s kuunda vipengee vya kikundi vinavyoweza kutekelezeka kwa hali ya kuelea, iliyozimwa, na amilifu kwa kuongeza .list-group-item-action
. Tunatenganisha madarasa haya ya uwongo ili kuhakikisha vikundi vya orodha vilivyoundwa na vipengee visivyoingiliana (kama vile <li>
s au <div>
s) havitoi uwezo wa kubofya au kugusa.
Hakikisha hutumii madarasa ya kawaida .btn
hapa .
<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>
Na <button>
s, unaweza pia kutumia disabled
sifa badala ya .disabled
darasa. Cha kusikitisha ni kwamba, <a>
s haiungi mkono sifa ya walemavu.
<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>
Ongeza .list-group-flush
ili kuondoa baadhi ya mipaka na pembe zilizoviringwa ili kutoa vipengee vya orodha ukingo-kwa-kingo katika kontena kuu (km, kadi).
- Cras justo odio
- Dapibus ac kuwezesha katika
- Morbi leo rius
- Porta ac consectetur ac
- Vestibulum na 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>
Tumia madarasa ya muktadha ili kuunda vipengee vya orodha vilivyo na usuli na rangi maridadi.
- Dapibus ac kuwezesha katika
- Hiki ni kipengee msingi cha kikundi cha orodha
- Hiki ni kipengee cha pili cha kikundi cha orodha
- Hiki ni kipengee cha orodha ya mafanikio
- Hiki ni kipengee cha orodha ya hatari
- Hiki ni kipengee cha orodha ya onyo
- Hiki ni kipengee cha orodha ya maelezo
- Hiki ni kipengee cha orodha nyepesi
- Hiki ni kipengee cha kikundi cheusi
<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>
Madarasa ya muktadha pia hufanya kazi na .list-group-item-action
. Kumbuka nyongeza ya mitindo ya kuelea hapa haipo katika mfano uliopita. Pia inaungwa mkono na .active
serikali; itumie ili kuonyesha uteuzi unaotumika kwenye kipengee cha kikundi cha muktadha.
<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>
Kuwasilisha maana kwa teknolojia za usaidizi
Kutumia rangi ili kuongeza maana hutoa tu kielelezo cha kuona, ambacho hakitawasilishwa kwa watumiaji wa teknolojia saidizi - kama vile visoma skrini. Hakikisha kwamba maelezo yanayoashiriwa na rangi ni dhahiri kutoka kwa maudhui yenyewe (km maandishi yanayoonekana), au yanajumuishwa kupitia njia mbadala, kama vile maandishi ya ziada yaliyofichwa na .sr-only
darasa.
Ongeza beji kwa bidhaa yoyote ya kikundi ili kuonyesha hesabu ambazo hazijasomwa, shughuli na zaidi kwa usaidizi wa baadhi ya huduma .
- Cras justo odio14
- Dapibus ac kuwezesha katika2
- Morbi leo rius1
<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>
Ongeza karibu HTML yoyote ndani, hata kwa vikundi vya orodha vilivyounganishwa kama ilivyo hapa chini, kwa usaidizi wa huduma za flexbox .
Orodhesha kichwa cha kipengee cha kikundi
siku 3 zilizopitaDonec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.
Donec id elit non mi porta.Orodhesha kichwa cha kipengee cha kikundi
siku 3 zilizopitaDonec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit.
Donec id elit non mi porta.Orodhesha kichwa cha kipengee cha kikundi
siku 3 zilizopitaDonec id elit non mi porta gravida at 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>
Tumia kichupo cha programu-jalizi ya JavaScript—ijumuishe kibinafsi au kupitia faili iliyokusanywa bootstrap.js
—ili kupanua kikundi chetu cha orodha ili kuunda vidirisha vya kichupo vya maudhui ya ndani.
Unaweza kuwezesha urambazaji wa kikundi cha orodha bila kuandika JavaScript yoyote kwa kubainisha tu data-toggle="list"
au kwa kipengele. Tumia sifa hizi za data kwenye .list-group-item
.
Washa kipengee cha orodha kinachoweza kutekelezeka kupitia JavaScript (kila kipengee cha orodha kinahitaji kuamilishwa kibinafsi):
Unaweza kuwezesha kipengee cha orodha kwa njia kadhaa:
Ili kufanya kidirisha cha vichupo kufifia, ongeza .fade
kwa kila .tab-pane
. Kidirisha cha kichupo cha kwanza lazima pia kiwe na .show
maudhui ya awali kuonekana.
Huwasha kipengele cha kipengee cha orodha na kontena ya maudhui. Kichupo kinapaswa kuwa na nodi ya chombo data-target
au inayolenga kwenye DOM.href
Huchagua kipengee cha orodha kilichotolewa na kuonyesha kidirisha chake kinachohusiana. Kipengee kingine chochote cha orodha ambacho kilichaguliwa hapo awali kitaacha kuchaguliwa na kidirisha chake kinachohusishwa hufichwa. Hurejesha kwa mpigaji kabla kidirisha cha kichupo hakijaonyeshwa (kwa mfano, kabla ya shown.bs.tab
tukio kutokea).
Wakati wa kuonyesha kichupo kipya, matukio huwaka kwa mpangilio ufuatao:
hide.bs.tab
(kwenye kichupo kinachotumika sasa)show.bs.tab
(kwenye kichupo cha-kuonyeshwa)hidden.bs.tab
(kwenye kichupo amilifu kilichotangulia, sawa na chahide.bs.tab
tukio)shown.bs.tab
(kwenye kichupo kipya-kilichoonyeshwa, sawa na chashow.bs.tab
tukio)
Ikiwa hakuna kichupo kilichokuwa tayari kinatumika, matukio hide.bs.tab
na hidden.bs.tab
matukio hayatafutwa.
Aina ya tukio | Maelezo |
---|---|
kichupo cha.bs | Tukio hili linawaka kwenye onyesho la kichupo, lakini kabla ya kichupo kipya kuonyeshwa. Tumia event.target na event.relatedTarget kulenga kichupo amilifu na kichupo amilifu cha awali (kama kinapatikana) mtawalia. |
kichupo.cha.bs | Tukio hili huwashwa kwenye onyesho la kichupo baada ya kichupo kuonyeshwa. Tumia event.target na event.relatedTarget kulenga kichupo amilifu na kichupo amilifu cha awali (kama kinapatikana) mtawalia. |
Ficha.bs.kichupo | Tukio hili huwaka wakati kichupo kipya kitaonyeshwa (na kwa hivyo kichupo amilifu cha awali kitafichwa). Tumia event.target na event.relatedTarget kulenga kichupo kinachotumika sasa na kichupo kipya kitakachotumika hivi karibuni, mtawalia. |
kichupo.bs.fiche | Tukio hili huwaka baada ya kichupo kipya kuonyeshwa (na kwa hivyo kichupo amilifu cha awali kimefichwa). Tumia event.target na event.relatedTarget kulenga kichupo amilifu cha awali na kichupo kipya kinachotumika, mtawalia. |