Source

Sehlopha sa likonopo

Kopanya letoto la likonopo moleng o le mong le sehlopha sa likonopo, 'me u li matlafatse haholo ka JavaScript.

Mohlala oa motheo

Koahela letoto la likonopo ka .btnin .btn-group. Kenya seea-le-moea sa boikhethelo sa JavaScript le boits'oaro ba li-checkbox ka li-button plugin tsa rona .

<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>
Netefatsa hore e nepahetse role'me u fane ka leibole

E le hore mahlale a thusang (joaloka libali tsa skrine) a bontše hore letoto la likonopo li arotsoe ka lihlopha, ho rolehlokahala hore ho fanoe ka tšobotsi e nepahetseng. Bakeng sa lihlopha tsa likonopo, sena se tla ba role="group", ha lithulusi li lokela ho ba le role="toolbar".

Ho feta moo, lihlopha le li-toolbar li lokela ho fuoa lengolo le hlakileng, kaha mahlale a mangata a thusang a ke ke a li phatlalatsa, leha ho na le karolo e nepahetseng. Mehlala e fanoeng mona, re sebelisa aria-label, empa mekhoa e meng e kang e aria-labelledbyka boela ea sebelisoa.

Konopo ea lisebelisoa

Kopanya lihlopha tsa likonopo ho li-toolbar bakeng sa likarolo tse rarahaneng. Sebelisa litlelase tsa lisebelisoa ha ho hlokahala ho arola lihlopha, likonopo le tse ling.

<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>

Ikutloe u lokolohile ho kopanya lihlopha tsa ho kenya le lihlopha tsa likonopo ka har'a lithulusi tsa hau. Joalo ka mohlala o kaholimo, mohlomong u tla hloka lisebelisoa tse ling ho beha lintho hantle.

<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>

Boholo

Sebakeng sa ho sebelisa li-button sizeng class ho konopo e 'ngoe le e' ngoe ka sehlopha, eketsa feela .btn-group-*ho e 'ngoe le e' ngoe .btn-group, ho kenyeletsoa e 'ngoe le e' ngoe ha u theha lihlopha tse ngata.



<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

Beha a .btn-groupka hare ho e 'ngoe .btn-groupha u batla li-menu tse theohang tse kopantsoeng le letoto la likonopo.

<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 id="btnGroupDrop1" type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
      Dropdown
    </button>
    <div class="dropdown-menu" aria-labelledby="btnGroupDrop1">
      <a class="dropdown-item" href="#">Dropdown link</a>
      <a class="dropdown-item" href="#">Dropdown link</a>
    </div>
  </div>
</div>

Phapang e emeng

Etsa hore likonopo tse 'maloa li hlahe li theohile ho fapana le tse tšekaletseng. Likonopo tsa ho arohana ha li sebetse mona.

<div class="btn-group-vertical">
  ...
</div>