Rōpū pātene
Whakarōpūhia he raupapa patene ki runga i te raina kotahi me te roopu paatene, me te kaha ki te JavaScript.
Tauira taketake
Takaia he raupapa patene ki .btn
roto .btn-group
. Tāpirihia ki runga i te reo irirangi JavaScript me te whanonga momo pouakataki me o taatau paatene mono .
<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>
Me whakarite kia tika role
ka hoatu he tapanga
Kia taea ai e nga hangarau awhina (penei i nga kaipanui mata) te whakaatu he raupapa o nga paatene kua whakarōpūhia, role
me whakarato he huanga tika. Mo nga roopu paatene, ko tenei role="group"
, ko nga paeutauta me whai role="toolbar"
.
I tua atu, me hoatu he tapanga ki nga roopu me nga paeutauta, na te mea karekau te nuinga o nga hangarau awhina e panui, ahakoa te ahua o te huanga mahi tika. I roto i nga tauira e whakaratohia ana i konei, ka whakamahia e matou aria-label
, engari ka aria-labelledby
taea ano te whakamahi etahi atu.
Paeutauta paatene
Whakakotahihia nga huinga roopu paatene ki roto i nga paeutauta patene mo nga waahanga uaua ake. Whakamahia nga karaehe whaipainga ina hiahiatia hei mokowhiti i nga roopu, nga paatene, me etahi atu.
<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>
Kaua e pai ki te whakakotahi i nga roopu whakauru me nga roopu paatene i o paeutauta. He rite ki te tauira i runga ake nei, ka hiahia pea koe ki etahi taputapu ahakoa ki te mokowhiti tika.
<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>
Te rahinga
Engari ki te tono i nga karaehe rahinga paatene ki ia paatene i roto i te roopu, taapiri noa .btn-group-*
ki ia .btn-group
, tae atu ki ia waahanga ka kohanga i nga roopu maha.
<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>
Kohanga
Tuhia he .btn-group
ki roto i tetahi atu .btn-group
ina hiahia koe ki nga tahua takaiho ka konatunatua ki te raupapa paatene.
<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>
Te rerekētanga poutū
Whakaatuhia he huinga o nga paatene kia noho poutū, kaua e whakapae. Kaore i te tautokohia nga takaiho paatene ritua i konei.
<div class="btn-group-vertical">
...
</div>