Wiesselt op den Haaptinhalt Wiesselt op d'Docs Navigatioun
in English

Knäppchen Grupp

Grupp eng Serie vu Knäppercher zesummen op enger eenzeger Linn oder stack se an enger vertikaler Kolonn.

Basis Beispill

Wickelt eng Serie vu Knäppercher mat .btnan .btn-group.

<div class="btn-group" role="group" aria-label="Basic example">
  <button type="button" class="btn btn-primary">Left</button>
  <button type="button" class="btn btn-primary">Middle</button>
  <button type="button" class="btn btn-primary">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 passende roleAttribut zur Verfügung gestallt ginn. Fir Knäpperchergruppen wier dëst role="group", während Toolbaren e role="toolbar".

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

Dës Klassen kënnen och a Gruppe vu Linken bäigefüügt ginn, als Alternativ zu den .navNavigatiounskomponenten .

<div class="btn-group">
  <a href="#" class="btn btn-primary active" aria-current="page">Active link</a>
  <a href="#" class="btn btn-primary">Link</a>
  <a href="#" class="btn btn-primary">Link</a>
</div>

Gemëschte Stiler

<div class="btn-group" role="group" aria-label="Basic mixed styles example">
  <button type="button" class="btn btn-danger">Left</button>
  <button type="button" class="btn btn-warning">Middle</button>
  <button type="button" class="btn btn-success">Right</button>
</div>

Ausgezeechent Stiler

<div class="btn-group" role="group" aria-label="Basic outlined example">
  <button type="button" class="btn btn-outline-primary">Left</button>
  <button type="button" class="btn btn-outline-primary">Middle</button>
  <button type="button" class="btn btn-outline-primary">Right</button>
</div>

Checkbox a Radio Knäppchen Gruppen

Kombinéiert Knäppchen-ähnlech Checkbox a Radio Toggle Knäppercher an eng nahtlos ausgesinn Knäpperchergrupp.

<div class="btn-group" role="group" aria-label="Basic checkbox toggle button group">
  <input type="checkbox" class="btn-check" id="btncheck1" autocomplete="off">
  <label class="btn btn-outline-primary" for="btncheck1">Checkbox 1</label>

  <input type="checkbox" class="btn-check" id="btncheck2" autocomplete="off">
  <label class="btn btn-outline-primary" for="btncheck2">Checkbox 2</label>

  <input type="checkbox" class="btn-check" id="btncheck3" autocomplete="off">
  <label class="btn btn-outline-primary" for="btncheck3">Checkbox 3</label>
</div>
<div class="btn-group" role="group" aria-label="Basic radio toggle button group">
  <input type="radio" class="btn-check" name="btnradio" id="btnradio1" autocomplete="off" checked>
  <label class="btn btn-outline-primary" for="btnradio1">Radio 1</label>

  <input type="radio" class="btn-check" name="btnradio" id="btnradio2" autocomplete="off">
  <label class="btn btn-outline-primary" for="btnradio2">Radio 2</label>

  <input type="radio" class="btn-check" name="btnradio" id="btnradio3" autocomplete="off">
  <label class="btn btn-outline-primary" for="btnradio3">Radio 3</label>
</div>

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 me-2" role="group" aria-label="First group">
    <button type="button" class="btn btn-primary">1</button>
    <button type="button" class="btn btn-primary">2</button>
    <button type="button" class="btn btn-primary">3</button>
    <button type="button" class="btn btn-primary">4</button>
  </div>
  <div class="btn-group me-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-info">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 me-2" role="group" aria-label="First group">
    <button type="button" class="btn btn-outline-secondary">1</button>
    <button type="button" class="btn btn-outline-secondary">2</button>
    <button type="button" class="btn btn-outline-secondary">3</button>
    <button type="button" class="btn btn-outline-secondary">4</button>
  </div>
  <div class="input-group">
    <div class="input-group-text" id="btnGroupAddon">@</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-outline-secondary">1</button>
    <button type="button" class="btn btn-outline-secondary">2</button>
    <button type="button" class="btn btn-outline-secondary">3</button>
    <button type="button" class="btn btn-outline-secondary">4</button>
  </div>
  <div class="input-group">
    <div class="input-group-text" id="btnGroupAddon2">@</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-primary">1</button>
  <button type="button" class="btn btn-primary">2</button>

  <div class="btn-group" role="group">
    <button id="btnGroupDrop1" type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
      Dropdown
    </button>
    <ul class="dropdown-menu" aria-labelledby="btnGroupDrop1">
      <li><a class="dropdown-item" href="#">Dropdown link</a></li>
      <li><a class="dropdown-item" href="#">Dropdown link</a></li>
    </ul>
  </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>