دکمه های گروهی

مجموعه ای از دکمه ها را روی یک خط واحد گروه بندی می کند.

مشاهده در سایت بوت استرپ

پیش فرض


<!-- Solid button group -->
<div class="btn-group" role="group" aria-label="Solid button group">
  <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>

<!-- Outline button group -->
<div class="btn-group" role="group" aria-label="Outline button group">
  <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>
// Solid button group
.btn-group(role="group", aria-label="Solid button group")
  button(type="button").btn.btn-primary
    | Left
  button(type="button").btn.btn-primary
    | Middle
  button(type="button").btn.btn-primary
    | Right

// Outline button group
.btn-group(role="group", aria-label="Outline button group")
  button(type="button").btn.btn-outline-primary
    | Left
  button(type="button").btn.btn-outline-primary
    | Middle
  button(type="button").btn.btn-outline-primary
    | Right

نوار ابزار

<!-- Toolbar example -->
<div class="btn-toolbar" role="toolbar" aria-label="Settings toolbar">
  <div class="btn-group me-2 mb-2" role="group" aria-label="Settings group">
    <button type="button" class="btn btn-dark btn-icon">
      <i class="fi-settings"></i>
    </button>
    <button type="button" class="btn btn-secondary btn-icon">A</button>
    <button type="button" class="btn btn-secondary btn-icon">
      <i class="fi-align-right"></i>
    </button>
    <button type="button" class="btn btn-secondary btn-icon">
      <i class="fi-rotate-right"></i>
    </button>
  </div>
  <div class="btn-group me-2 mb-2" role="group" aria-label="Apply settings">
    <button type="button" class="btn btn-success">
      <i class="fi-check me-2"></i>
      Apply
    </button>
  </div>
  <div class="btn-group mb-2" role="group" aria-label="Delete settings">
    <button type="button" class="btn btn-translucent-danger btn-icon">
      <i class="fi-trash"></i>
    </button>
  </div>
</div>

<!-- Pagination example -->
<div class="btn-toolbar" role="toolbar" aria-label="Pagination">
  <div class="btn-group me-2 mb-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>
  </div>
  <div class="btn-group me-2 mb-2" role="group" aria-label="Second group">
    <button type="button" class="btn btn-outline-secondary">4</button>
    <button type="button" class="btn btn-outline-secondary">5</button>
  </div>
  <div class="btn-group mb-2" role="group" aria-label="Third group">
    <button type="button" class="btn btn-outline-secondary">6</button>
  </div>
</div>
// Toolbar example
.btn-toolbar(role="toolbar", aria-label="Settings toolbar")
  .btn-group.me-2.mb-2(role="group", aria-label="Settings group")
    button(type="button").btn.btn-dark.btn-icon
      i.fi-settings
    button(type="button").btn.btn-secondary.btn-icon
      | A
    button(type="button").btn.btn-secondary.btn-icon
      i.fi-align-right
    button(type="button").btn.btn-secondary.btn-icon
      i.fi-rotate-right
  .btn-group.me-2.mb-2(role="group", aria-label="Apply settings")
    button(type="button").btn.btn-success
      i.fi-check.me-2
      | Apply
  .btn-group.mb-2(role="group", aria-label="Delete settings")
    button(type="button").btn.button-translucent-danger.btn-icon
      i.fi-trash

// Pagination example
.btn-toolbar(role="toolbar", aria-label="Pagination")
  .btn-group.me-2.mb-2(role="group", aria-label="First group")
    button(type="button").btn.btn-pill.btn-outline-secondary
      | 1
    button(type="button").btn.btn-pill.btn-outline-secondary
      | 2
    button(type="button").btn.btn-pill.btn-outline-secondary
      | 3
  .btn-group.me-2.mb-2(role="group", aria-label="Second group")
    button(type="button").btn.btn-pill.btn-outline-secondary
      | 4
    button(type="button").btn.btn-pill.btn-outline-secondary
      | 5
  .btn-group.mb-2(role="group", aria-label="Third group")
    button(type="button").btn.btn-pill.btn-outline-secondary
      | 6

سایزهای مختلف





<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>
.btn-group.btn-group-lg(role="group" aria-label="...")
  | ...
.btn-group(role="group" aria-label="...")
  | ...
.btn-group.btn-group-sm(role="group" aria-label="...")
  | ...

تودرتو منو یک سطحی (Dropdown)

<!-- Button group with nested dropdown -->
<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 type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
      Dropdown
    </button>
    <div class="dropdown-menu my-1">
      <a href="#" class="dropdown-item">Dropdown link</a>
      <a href="#" class="dropdown-item">Dropdown link</a>
      <a href="#" class="dropdown-item">Dropdown link</a>
    </div>
  </div>
</div>

<!-- Button group with nested dropdown -->
<div class="btn-group" role="group" aria-label="Button group with nested dropdown">
  <button type="button" class="btn btn-outline-secondary">1</button>
  <button type="button" class="btn btn-outline-secondary">2</button>
  <div class="btn-group" role="group">
    <button type="button" class="btn btn-outline-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
      Dropdown
    </button>
    <div class="dropdown-menu my-1">
      <a href="#" class="dropdown-item">Dropdown link</a>
      <a href="#" class="dropdown-item">Dropdown link</a>
      <a href="#" class="dropdown-item">Dropdown link</a>
    </div>
  </div>
</div>
// Button group with nested dropdown
.btn-group(role="group", aria-label="Button group with nested dropdown")
  button(type="button").btn.btn-primary
    | 1
  button(type="button").btn.btn-primary
    | 2
  .btn-group(role='group')
    button(type="button", data-bs-toggle="dropdown", aria-haspopup="true", aria-expanded="false").btn.btn-primary.dropdown-toggle Dropdown
    .dropdown-menu.my-1
      a(href="#").dropdown-item
        | Dropdown link
      a(href="#").dropdown-item
        | Dropdown link
      a(href="#").dropdown-item
        | Dropdown link

// Button group with nested dropdown
.btn-group(role="group", aria-label="Button group with nested dropdown")
  button(type="button").btn.btn-outline-secondary
    | 1
  button(type="button").btn.btn-outline-secondary
    | 2
  .btn-group(role='group')
    button(type="button", data-bs-toggle="dropdown", aria-haspopup="true", aria-expanded="false").btn.btn-outline-secondary.dropdown-toggle
      | Dropdown
    .dropdown-menu.my-1
      a(href="#").dropdown-item
        | Dropdown link
      a(href="#").dropdown-item
        | Dropdown link
      a(href="#").dropdown-item
        | Dropdown link
بالا