Source

Knäppchen Grupp

Gruppéiert eng Serie vu Knäppercher zesummen op enger eenzeger Linn mat der Knäppergrupp, a super-power se mat JavaScript.

Basis Beispill

Wickelt eng Serie vu Knäppercher mat .btnan .btn-group. Füügt op optional JavaScript Radio a Checkbox Style Verhalen mat eisem Knäppchen 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>
Vergewëssert Iech richteg rolea gitt e Label

Fir Hëllefstechnologien (wéi Écran Lieser) ze vermëttelen datt eng Serie vu Knäpper gruppéiert ass, muss e passenden roleAttribut geliwwert ginn. Fir Knäpperchergruppen wier dëst role="group", während Toolbaren e role="toolbar".

Zousätzlech sollten Gruppen an Toolbaren en explizit Label kréien, well déi meescht Hëllefstechnologien se soss net annoncéieren, trotz der Präsenz vum richtege Rollattribut. An de Beispiller hei geliwwert benotze mir aria-label, awer Alternativen wéi aria-labelledbykënnen och benotzt ginn.

Knäppchen Toolbar

Kombinéiert Sets vu Knäpperchergruppen a Knäppchen Toolbaren fir méi komplex Komponenten. Benotzt Utilityklassen wéi néideg fir Gruppen, Knäppercher a méi auszeraumen.

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

Fillt Iech gratis Inputgruppen mat Knäppchengruppen an Ären Toolbaren ze mëschen. Ähnlech wéi am Beispill hei uewen, braucht Dir wahrscheinlech e puer Utilities awer fir d'Saachen richteg ze raumen.

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

Gréisst

Amplaz d'Knäppchengréisst Klassen op all Knäppchen an enger Grupp z'applizéieren, füügt just .btn-group-*un all .btn-group, inklusiv jidderee wann Dir verschidde Gruppen nestéiert.



<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

Plaz e .btn-groupbannent engem aneren .btn-groupwann Dir wëllt Dropdown-Menüen gemëscht mat enger Serie vu Knäppercher.

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

Vertikal Variatioun

Maacht eng Rei vu Knäppercher vertikal gestapelt anstatt horizontal. Split Button Dropdowns ginn hei net ënnerstëtzt.

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