Bhatani boka
Boka nhevedzano yemabhatani pamwe chete pamutsara mumwe neboka remabhatani, uye wedzera simba iwo neJavaScript.
Basic muenzaniso
Putira mabhatani akatevedzana ne .btn
in .btn-group
. Wedzera pane inosarudzika JavaScript redhiyo uye cheki bhokisi maitiro nemabhatani edu plugin .
<div class="btn-group" role="group" aria-label="Basic example">
<button type="button" class="btn btn-secondary">Left</button>
<button type="button" class="btn btn-secondary">Middle</button>
<button type="button" class="btn btn-secondary">Right</button>
</div>
Iva nechokwadi chechokwadi role
uye upe label
Kuti matekinoroji anobatsira (akadai semascreen readers) aratidze kuti mabhatani akatevedzana akaiswa mumapoka, role
hunhu hwakakodzera hunoda kupihwa. Kumapoka emabhatani, izvi zvingave role="group"
, ukuwo maturusi anofanirwa kunge aine role="toolbar"
.
Pamusoro pezvo, mapoka uye maturusi anofanirwa kupihwa mavara akajeka, sezvo tekinoroji zhinji dzekubatsira dzisingazozvizivise, kunyangwe kuvepo kwehunhu hwakakodzera. Mumienzaniso yakapihwa pano, tinoshandisa aria-label
, asi dzimwe nzira dzakadai aria-labelledby
dzinogona kushandiswa zvakare.
Bhatani toolbar
Sanganisa maseti emapoka emabhatani kuita mabhatani eturusi mabhatani ezvimwe zvinhu zvakaoma kunzwisisa. Shandisa makirasi ekushandisa sezvinodiwa kuisa mapoka mapoka, mabhatani, nezvimwe.
<div class="btn-toolbar" role="toolbar" aria-label="Toolbar with button groups">
<div class="btn-group mr-2" role="group" aria-label="First group">
<button type="button" class="btn btn-secondary">1</button>
<button type="button" class="btn btn-secondary">2</button>
<button type="button" class="btn btn-secondary">3</button>
<button type="button" class="btn btn-secondary">4</button>
</div>
<div class="btn-group mr-2" role="group" aria-label="Second group">
<button type="button" class="btn btn-secondary">5</button>
<button type="button" class="btn btn-secondary">6</button>
<button type="button" class="btn btn-secondary">7</button>
</div>
<div class="btn-group" role="group" aria-label="Third group">
<button type="button" class="btn btn-secondary">8</button>
</div>
</div>
Inzwa wakasununguka kusanganisa mapoka ekuisa nemabhatani mapoka mumaturusi ako. Zvakafanana nemuenzaniso uri pamusoro, iwe ungangoda zvimwe zvekushandisa asi kuisa zvinhu nemazvo.
<div class="btn-toolbar mb-3" role="toolbar" aria-label="Toolbar with button groups">
<div class="btn-group mr-2" role="group" aria-label="First group">
<button type="button" class="btn btn-secondary">1</button>
<button type="button" class="btn btn-secondary">2</button>
<button type="button" class="btn btn-secondary">3</button>
<button type="button" class="btn btn-secondary">4</button>
</div>
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text" id="btnGroupAddon">@</div>
</div>
<input type="text" class="form-control" placeholder="Input group example" aria-label="Input group example" aria-describedby="btnGroupAddon">
</div>
</div>
<div class="btn-toolbar justify-content-between" role="toolbar" aria-label="Toolbar with button groups">
<div class="btn-group" role="group" aria-label="First group">
<button type="button" class="btn btn-secondary">1</button>
<button type="button" class="btn btn-secondary">2</button>
<button type="button" class="btn btn-secondary">3</button>
<button type="button" class="btn btn-secondary">4</button>
</div>
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text" id="btnGroupAddon2">@</div>
</div>
<input type="text" class="form-control" placeholder="Input group example" aria-label="Input group example" aria-describedby="btnGroupAddon2">
</div>
</div>
Kukura
Panzvimbo pekushandisa bhatani saizi makirasi kune yega bhatani muboka, ingo wedzera .btn-group-*
kune yega yega .btn-group
, kusanganisira yega yega paunenge uchigadzira mapoka akawanda.
<div class="btn-group btn-group-lg" role="group" aria-label="...">...</div>
<div class="btn-group" role="group" aria-label="...">...</div>
<div class="btn-group btn-group-sm" role="group" aria-label="...">...</div>
Nesting
Isa .btn-group
mukati meimwe .btn-group
kana iwe uchida mamenu ekudonha akasanganiswa nenhevedzano yemabhatani.
<div class="btn-group" role="group" aria-label="Button group with nested dropdown">
<button type="button" class="btn btn-secondary">1</button>
<button type="button" class="btn btn-secondary">2</button>
<div class="btn-group" role="group">
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
Dropdown
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#">Dropdown link</a>
<a class="dropdown-item" href="#">Dropdown link</a>
</div>
</div>
</div>
Vertical variation
Itai kuti mabhatani aite seti akaturikidzana kwete akachinjika. Kudonhedza mabhatani ekupatsanura hakushandi pano.
<div class="btn-group-vertical">
...
</div>