Svetuka kune chikuru content Svetuka kuenda kudocs navigation
in English

Rondedzera boka

Mapoka ezvirongwa chinhu chinochinjika uye chine simba chekuratidza zvakatevedzana zvemukati. Shandura uye uwedzere iwo kuti atsigire zvingangoita chero zviri mukati.

Basic muenzaniso

Boka rinonyanya kukosha irondedzero isina kurongeka ine zvinyorwa uye makirasi akakodzera. Vaka pamusoro payo nesarudzo dzinotevera, kana neCSS yako sezvinodiwa.

  • Chinhu
  • Chinhu chechipiri
  • Chinhu chechitatu
  • Chinhu chechina
  • Uye wechishanu
<ul class="list-group">
  <li class="list-group-item">An item</li>
  <li class="list-group-item">A second item</li>
  <li class="list-group-item">A third item</li>
  <li class="list-group-item">A fourth item</li>
  <li class="list-group-item">And a fifth one</li>
</ul>

Active zvinhu

Wedzera .activekune a .list-group-itemkuratidza ikozvino inoshanda sarudzo.

  • Chinhu chinoshanda
  • Chinhu chechipiri
  • Chinhu chechitatu
  • Chinhu chechina
  • Uye wechishanu
<ul class="list-group">
  <li class="list-group-item active" aria-current="true">An active item</li>
  <li class="list-group-item">A second item</li>
  <li class="list-group-item">A third item</li>
  <li class="list-group-item">A fourth item</li>
  <li class="list-group-item">And a fifth one</li>
</ul>

Zvinhu zvakaremara

Wedzera .disabledkune a .list-group-itemkuti iite seyakaremadzwa. Ziva kuti zvimwe zvinhu zvine .disabledzvinozodawo tsika JavaScript kudzima zvizere zviitiko zvavo zvekudzvanya (semuenzaniso, zvinongedzo).

  • Chinhu chakaremara
  • Chinhu chechipiri
  • Chinhu chechitatu
  • Chinhu chechina
  • Uye wechishanu
<ul class="list-group">
  <li class="list-group-item disabled" aria-disabled="true">A disabled item</li>
  <li class="list-group-item">A second item</li>
  <li class="list-group-item">A third item</li>
  <li class="list-group-item">A fourth item</li>
  <li class="list-group-item">And a fifth one</li>
</ul>

Shandisa <a>s kana <button>s kugadzira zvinogoneka rondedzero yeboka zvinhu zvine hover, yakaremara, uye inoshanda nyika nekuwedzera .list-group-item-action. Isu tinopatsanura aya emanyepo-makirasi kuti tive nechokwadi chemapoka akagadzirwa neasina-anopindirana zvinhu (senge <li>s kana <div>s) haape kudzvanya kana kudzvanya kugona.

Iva nechokwadi chekusashandisa .btnmakirasi akajairwa pano .

<div class="list-group">
  <a href="#" class="list-group-item list-group-item-action active" aria-current="true">
    The current link item
  </a>
  <a href="#" class="list-group-item list-group-item-action">A second link item</a>
  <a href="#" class="list-group-item list-group-item-action">A third link item</a>
  <a href="#" class="list-group-item list-group-item-action">A fourth link item</a>
  <a class="list-group-item list-group-item-action disabled">A disabled link item</a>
</div>

Ne <button>s, iwe unogona zvakare kushandisa disabledhunhu pachinzvimbo .disabledchekirasi. Zvinosuruvarisa, <a>s haitsigire vakaremara hunhu.

<div class="list-group">
  <button type="button" class="list-group-item list-group-item-action active" aria-current="true">
    The current button
  </button>
  <button type="button" class="list-group-item list-group-item-action">A second item</button>
  <button type="button" class="list-group-item list-group-item-action">A third button item</button>
  <button type="button" class="list-group-item list-group-item-action">A fourth button item</button>
  <button type="button" class="list-group-item list-group-item-action" disabled>A disabled button item</button>
</div>

Flush

Wedzera .list-group-flushkuti ubvise mamwe mabhodha uye makona akatenderedzwa kupa runyorwa zvinhu zveboka kumucheto-kune-kumucheto mumudziyo wevabereki (semuenzaniso, makadhi).

  • Chinhu
  • Chinhu chechipiri
  • Chinhu chechitatu
  • Chinhu chechina
  • Uye wechishanu
<ul class="list-group list-group-flush">
  <li class="list-group-item">An item</li>
  <li class="list-group-item">A second item</li>
  <li class="list-group-item">A third item</li>
  <li class="list-group-item">A fourth item</li>
  <li class="list-group-item">And a fifth one</li>
</ul>

Numbered

Wedzera iyo .list-group-numberedmodhifita kirasi (uye nesarudzo shandisa <ol>chinhu) kuti usarudze munhamba dzeboka zvinhu. Nhamba dzinogadzirwa kuburikidza neCSS (kusiyana <ol>neiyo s default browser styling) yekuiswa zvirinani mukati mezvinyorwa zveboka zvinhu uye kubvumidza zvirinani kugadzirisa.

Nhamba dzinogadzirwa ne counter-resetpa <ol>, uye dzobva dzagadzirwa nekuiswa ne ::beforepseudo-element pa <li>with counter-incrementand content.

  1. Chinhu chakanyorwa
  2. Chinhu chakanyorwa
  3. Chinhu chakanyorwa
<ol class="list-group list-group-numbered">
  <li class="list-group-item">A list item</li>
  <li class="list-group-item">A list item</li>
  <li class="list-group-item">A list item</li>
</ol>

Izvi zvinoshanda zvikuru netsika yezvinhu zvakare.

  1. Subheading
    Zvemukati zvechinyorwa chinhu
    14
  2. Subheading
    Zvemukati zvechinyorwa chinhu
    14
  3. Subheading
    Zvemukati zvechinyorwa chinhu
    14
<ol class="list-group list-group-numbered">
  <li class="list-group-item d-flex justify-content-between align-items-start">
    <div class="ms-2 me-auto">
      <div class="fw-bold">Subheading</div>
      Content for list item
    </div>
    <span class="badge bg-primary rounded-pill">14</span>
  </li>
  <li class="list-group-item d-flex justify-content-between align-items-start">
    <div class="ms-2 me-auto">
      <div class="fw-bold">Subheading</div>
      Content for list item
    </div>
    <span class="badge bg-primary rounded-pill">14</span>
  </li>
  <li class="list-group-item d-flex justify-content-between align-items-start">
    <div class="ms-2 me-auto">
      <div class="fw-bold">Subheading</div>
      Content for list item
    </div>
    <span class="badge bg-primary rounded-pill">14</span>
  </li>
</ol>

Horizontal

Wedzera .list-group-horizontalkuti uchinje marongero ezvinyorwa zveboka kubva pakatwasuka kuenda kune yakachinjika pamapoinzi ese. Neimwe nzira, sarudza chinodaira chinodavirwa .list-group-horizontal-{sm|md|lg|xl|xxl}kuita boka rerondedzero rakachinjika kutanga pabreakpoint's min-width. Parizvino mapoka emazita akachinjika haagone kusanganiswa nemapoka erunyoro.

ProTip: Unoda kuenzana-hupamhi rondedzero yeboka zvinhu kana yakachinjika? Wedzera .flex-fillkune chimwe nechimwe cheboka chinhu.

  • Chinhu
  • Chinhu chechipiri
  • Chinhu chechitatu
  • Chinhu
  • Chinhu chechipiri
  • Chinhu chechitatu
  • Chinhu
  • Chinhu chechipiri
  • Chinhu chechitatu
  • Chinhu
  • Chinhu chechipiri
  • Chinhu chechitatu
  • Chinhu
  • Chinhu chechipiri
  • Chinhu chechitatu
  • Chinhu
  • Chinhu chechipiri
  • Chinhu chechitatu
<ul class="list-group list-group-horizontal">
  <li class="list-group-item">An item</li>
  <li class="list-group-item">A second item</li>
  <li class="list-group-item">A third item</li>
</ul>
<ul class="list-group list-group-horizontal-sm">
  <li class="list-group-item">An item</li>
  <li class="list-group-item">A second item</li>
  <li class="list-group-item">A third item</li>
</ul>
<ul class="list-group list-group-horizontal-md">
  <li class="list-group-item">An item</li>
  <li class="list-group-item">A second item</li>
  <li class="list-group-item">A third item</li>
</ul>
<ul class="list-group list-group-horizontal-lg">
  <li class="list-group-item">An item</li>
  <li class="list-group-item">A second item</li>
  <li class="list-group-item">A third item</li>
</ul>
<ul class="list-group list-group-horizontal-xl">
  <li class="list-group-item">An item</li>
  <li class="list-group-item">A second item</li>
  <li class="list-group-item">A third item</li>
</ul>
<ul class="list-group list-group-horizontal-xxl">
  <li class="list-group-item">An item</li>
  <li class="list-group-item">A second item</li>
  <li class="list-group-item">A third item</li>
</ul>

Contextual classes

Shandisa makirasi emamiriro ekugadzirisa zvinhu kurongedza zvinhu zvine mamiriro ekunze uye ruvara.

  • Chinhu cheboka chiri nyore chinogara chiripo
  • Chinhu chakareruka chekutanga cheboka
  • Chinhu chakareruka chechipiri cheboka
  • Chinhu cheboka chekubudirira chiri nyore
  • Chinhu cheboka chenjodzi chiri nyore
  • Chinhu cheboka chenyevero chiri nyore
  • Chinhu chakareruka cheruzivo cheboka
  • Chinhu cheboka chakareruka chechiedza
  • Chinhu chiri nyore chakasviba cheboka
<ul class="list-group">
  <li class="list-group-item">A simple default list group item</li>

  <li class="list-group-item list-group-item-primary">A simple primary list group item</li>
  <li class="list-group-item list-group-item-secondary">A simple secondary list group item</li>
  <li class="list-group-item list-group-item-success">A simple success list group item</li>
  <li class="list-group-item list-group-item-danger">A simple danger list group item</li>
  <li class="list-group-item list-group-item-warning">A simple warning list group item</li>
  <li class="list-group-item list-group-item-info">A simple info list group item</li>
  <li class="list-group-item list-group-item-light">A simple light list group item</li>
  <li class="list-group-item list-group-item-dark">A simple dark list group item</li>
</ul>

Contextual makirasi anoshandawo ne .list-group-item-action. Cherechedza kuwedzera kwezvitaera zvehover pano hazvipo mumuenzaniso wapfuura. Uyewo inotsigirwa ihurumende .active; shandisa kuratidza sarudzo inoshanda pachinhu cheboka rezvinyorwa.

<div class="list-group">
  <a href="#" class="list-group-item list-group-item-action">A simple default list group item</a>

  <a href="#" class="list-group-item list-group-item-action list-group-item-primary">A simple primary list group item</a>
  <a href="#" class="list-group-item list-group-item-action list-group-item-secondary">A simple secondary list group item</a>
  <a href="#" class="list-group-item list-group-item-action list-group-item-success">A simple success list group item</a>
  <a href="#" class="list-group-item list-group-item-action list-group-item-danger">A simple danger list group item</a>
  <a href="#" class="list-group-item list-group-item-action list-group-item-warning">A simple warning list group item</a>
  <a href="#" class="list-group-item list-group-item-action list-group-item-info">A simple info list group item</a>
  <a href="#" class="list-group-item list-group-item-action list-group-item-light">A simple light list group item</a>
  <a href="#" class="list-group-item list-group-item-action list-group-item-dark">A simple dark list group item</a>
</div>
Kuendesa zvinoreva kunobatsira matekinoroji

Kushandisa ruvara kuwedzera zvinoreva kunongopa chiratidzo chekuona, icho chisingazopirwe kune vashandisi vetekinoroji yekubatsira - senge zvidzitiro zvekuverenga. Ita shuwa kuti ruzivo rwunoratidzwa neruvara rwuri pachena kubva pane zvirimo (semuzvinyorwa zvinooneka), kana kuti zvinosanganisirwa neimwe nzira, senge mamwe mavara akavigwa .visually-hiddennekirasi.

Nemabheji

Wedzera mabheji kune chero chinyorwa cheboka chinhu kuratidza zvisingaverengeki kuverenga, chiitiko, uye nezvimwe nerubatsiro rwezvimwe zvinoshandiswa .

  • Chinhu chakanyorwa14
  • Chinhu chechipiri chinyorwa2
  • Chinhu chechitatu chinyorwa1
<ul class="list-group">
  <li class="list-group-item d-flex justify-content-between align-items-center">
    A list item
    <span class="badge bg-primary rounded-pill">14</span>
  </li>
  <li class="list-group-item d-flex justify-content-between align-items-center">
    A second list item
    <span class="badge bg-primary rounded-pill">2</span>
  </li>
  <li class="list-group-item d-flex justify-content-between align-items-center">
    A third list item
    <span class="badge bg-primary rounded-pill">1</span>
  </li>
</ul>

Custom content

Wedzera ingangoita chero HTML mukati, kunyangwe yeakabatana rondedzero mapoka seari pazasi, nerubatsiro rweflexbox utilities .

<div class="list-group">
  <a href="#" class="list-group-item list-group-item-action active" aria-current="true">
    <div class="d-flex w-100 justify-content-between">
      <h5 class="mb-1">List group item heading</h5>
      <small>3 days ago</small>
    </div>
    <p class="mb-1">Some placeholder content in a paragraph.</p>
    <small>And some small print.</small>
  </a>
  <a href="#" class="list-group-item list-group-item-action">
    <div class="d-flex w-100 justify-content-between">
      <h5 class="mb-1">List group item heading</h5>
      <small class="text-muted">3 days ago</small>
    </div>
    <p class="mb-1">Some placeholder content in a paragraph.</p>
    <small class="text-muted">And some muted small print.</small>
  </a>
  <a href="#" class="list-group-item list-group-item-action">
    <div class="d-flex w-100 justify-content-between">
      <h5 class="mb-1">List group item heading</h5>
      <small class="text-muted">3 days ago</small>
    </div>
    <p class="mb-1">Some placeholder content in a paragraph.</p>
    <small class="text-muted">And some muted small print.</small>
  </a>
</div>

Checkboxes nemaredhiyo

Isa mabhokisi eBootstrap echeki nemaredhiyo mukati mezvinyorwa zveboka zvinhu uye gadzirisa sezvinodiwa. Unogona kuzvishandisa pasina <label>s, asi ndapota yeuka kuisa aria-labelhunhu uye kukosha kwekuwanikwa.

  • Chekutanga bhokisi
  • Chechipiri cheki bhokisi
  • Chechitatu cheki bhokisi
  • Cheki bhokisi rechina
  • Yechishanu cheki bhokisi
<ul class="list-group">
  <li class="list-group-item">
    <input class="form-check-input me-1" type="checkbox" value="" aria-label="...">
    First checkbox
  </li>
  <li class="list-group-item">
    <input class="form-check-input me-1" type="checkbox" value="" aria-label="...">
    Second checkbox
  </li>
  <li class="list-group-item">
    <input class="form-check-input me-1" type="checkbox" value="" aria-label="...">
    Third checkbox
  </li>
  <li class="list-group-item">
    <input class="form-check-input me-1" type="checkbox" value="" aria-label="...">
    Fourth checkbox
  </li>
  <li class="list-group-item">
    <input class="form-check-input me-1" type="checkbox" value="" aria-label="...">
    Fifth checkbox
  </li>
</ul>

Uye kana iwe uchida <label>s senzvimbo .list-group-itemdzakakura dzakarova, unogona kuzviita, futi.

<div class="list-group">
  <label class="list-group-item">
    <input class="form-check-input me-1" type="checkbox" value="">
    First checkbox
  </label>
  <label class="list-group-item">
    <input class="form-check-input me-1" type="checkbox" value="">
    Second checkbox
  </label>
  <label class="list-group-item">
    <input class="form-check-input me-1" type="checkbox" value="">
    Third checkbox
  </label>
  <label class="list-group-item">
    <input class="form-check-input me-1" type="checkbox" value="">
    Fourth checkbox
  </label>
  <label class="list-group-item">
    <input class="form-check-input me-1" type="checkbox" value="">
    Fifth checkbox
  </label>
</div>

Sass

Variables

$list-group-color:                  $gray-900;
$list-group-bg:                     $white;
$list-group-border-color:           rgba($black, .125);
$list-group-border-width:           $border-width;
$list-group-border-radius:          $border-radius;

$list-group-item-padding-y:         $spacer * .5;
$list-group-item-padding-x:         $spacer;
$list-group-item-bg-scale:          -80%;
$list-group-item-color-scale:       40%;

$list-group-hover-bg:               $gray-100;
$list-group-active-color:           $component-active-color;
$list-group-active-bg:              $component-active-bg;
$list-group-active-border-color:    $list-group-active-bg;

$list-group-disabled-color:         $gray-600;
$list-group-disabled-bg:            $list-group-bg;

$list-group-action-color:           $gray-700;
$list-group-action-hover-color:     $list-group-action-color;

$list-group-action-active-color:    $body-color;
$list-group-action-active-bg:       $gray-200;

Mixins

Inoshandiswa pamwe chete $theme-colorsnekugadzira iwo mamiriro akasiyana makirasi es .list-group-item.

@mixin list-group-item-variant($state, $background, $color) {
  .list-group-item-#{$state} {
    color: $color;
    background-color: $background;

    &.list-group-item-action {
      &:hover,
      &:focus {
        color: $color;
        background-color: shade-color($background, 10%);
      }

      &.active {
        color: $white;
        background-color: $color;
        border-color: $color;
      }
    }
  }
}

Loop

Loop iyo inogadzira iyo modifier makirasi ane list-group-item-variant()mixin.

// List group contextual variants
//
// Add modifier classes to change text and background color on individual items.
// Organizationally, this must come after the `:hover` states.

@each $state, $value in $theme-colors {
  $list-group-variant-bg: shift-color($value, $list-group-item-bg-scale);
  $list-group-variant-color: shift-color($value, $list-group-item-color-scale);
  @if (contrast-ratio($list-group-variant-bg, $list-group-variant-color) < $min-contrast-ratio) {
    $list-group-variant-color: mix($value, color-contrast($list-group-variant-bg), abs($list-group-item-color-scale));
  }

  @include list-group-item-variant($state, $list-group-variant-bg, $list-group-variant-color);
}

JavaScript maitiro

Shandisa iyo tebhu JavaScript plugin-isanganise iyo yega kana kuburikidza neyakaunganidzwa bootstrap.jsfaira-kuwedzera yedu runyorwa boka kuti ugadzire zvinobatika zvemukati zvemukati.

<div class="row">
  <div class="col-4">
    <div class="list-group" id="list-tab" role="tablist">
      <a class="list-group-item list-group-item-action active" id="list-home-list" data-bs-toggle="list" href="#list-home" role="tab" aria-controls="list-home">Home</a>
      <a class="list-group-item list-group-item-action" id="list-profile-list" data-bs-toggle="list" href="#list-profile" role="tab" aria-controls="list-profile">Profile</a>
      <a class="list-group-item list-group-item-action" id="list-messages-list" data-bs-toggle="list" href="#list-messages" role="tab" aria-controls="list-messages">Messages</a>
      <a class="list-group-item list-group-item-action" id="list-settings-list" data-bs-toggle="list" href="#list-settings" role="tab" aria-controls="list-settings">Settings</a>
    </div>
  </div>
  <div class="col-8">
    <div class="tab-content" id="nav-tabContent">
      <div class="tab-pane fade show active" id="list-home" role="tabpanel" aria-labelledby="list-home-list">...</div>
      <div class="tab-pane fade" id="list-profile" role="tabpanel" aria-labelledby="list-profile-list">...</div>
      <div class="tab-pane fade" id="list-messages" role="tabpanel" aria-labelledby="list-messages-list">...</div>
      <div class="tab-pane fade" id="list-settings" role="tabpanel" aria-labelledby="list-settings-list">...</div>
    </div>
  </div>
</div>

Kushandisa data hunhu

Unogona kumisikidza rondedzero yekufamba kweboka pasina kunyora chero JavaScript nekungotsanangura data-bs-toggle="list"kana pane chinhu. Shandisa idzi data attribution pa .list-group-item.

<div role="tabpanel">
  <!-- List group -->
  <div class="list-group" id="myList" role="tablist">
    <a class="list-group-item list-group-item-action active" data-bs-toggle="list" href="#home" role="tab">Home</a>
    <a class="list-group-item list-group-item-action" data-bs-toggle="list" href="#profile" role="tab">Profile</a>
    <a class="list-group-item list-group-item-action" data-bs-toggle="list" href="#messages" role="tab">Messages</a>
    <a class="list-group-item list-group-item-action" data-bs-toggle="list" href="#settings" role="tab">Settings</a>
  </div>

  <!-- Tab panes -->
  <div class="tab-content">
    <div class="tab-pane active" id="home" role="tabpanel">...</div>
    <div class="tab-pane" id="profile" role="tabpanel">...</div>
    <div class="tab-pane" id="messages" role="tabpanel">...</div>
    <div class="tab-pane" id="settings" role="tabpanel">...</div>
  </div>
</div>

Via JavaScript

Gonesa chinobatika chinyorwa chinhu kuburikidza neJavaScript (chimwe nechimwe chinyorwa chinoda kuvhurwa chega):

var triggerTabList = [].slice.call(document.querySelectorAll('#myTab a'))
triggerTabList.forEach(function (triggerEl) {
  var tabTrigger = new bootstrap.Tab(triggerEl)

  triggerEl.addEventListener('click', function (event) {
    event.preventDefault()
    tabTrigger.show()
  })
})

Iwe unogona kumisa chinhu chega chega munzira dzinoverengeka:

var triggerEl = document.querySelector('#myTab a[href="#profile"]')
bootstrap.Tab.getInstance(triggerEl).show() // Select tab by name

var triggerFirstTabEl = document.querySelector('#myTab li:first-child a')
bootstrap.Tab.getInstance(triggerFirstTabEl).show() // Select first tab

Fade effect

Kuita kuti ma tabs panel apere mukati, wedzera .fadekune imwe neimwe .tab-pane. Yekutanga tebhu pani inofanirawo .showkuita kuti zvekutanga zvionekwe.

<div class="tab-content">
  <div class="tab-pane fade show active" id="home" role="tabpanel">...</div>
  <div class="tab-pane fade" id="profile" role="tabpanel">...</div>
  <div class="tab-pane fade" id="messages" role="tabpanel">...</div>
  <div class="tab-pane fade" id="settings" role="tabpanel">...</div>
</div>

Nzira

constructor

Inomisikidza chinyorwa chechimwe chinhu uye mudziyo wemukati. Tab inofanirwa kunge iine data-bs-targetkana hrefyakanangana nemudziyo node muDOM.

<div class="list-group" id="myList" role="tablist">
  <a class="list-group-item list-group-item-action active" data-bs-toggle="list" href="#home" role="tab">Home</a>
  <a class="list-group-item list-group-item-action" data-bs-toggle="list" href="#profile" role="tab">Profile</a>
  <a class="list-group-item list-group-item-action" data-bs-toggle="list" href="#messages" role="tab">Messages</a>
  <a class="list-group-item list-group-item-action" data-bs-toggle="list" href="#settings" role="tab">Settings</a>
</div>

<div class="tab-content">
  <div class="tab-pane active" id="home" role="tabpanel">...</div>
  <div class="tab-pane" id="profile" role="tabpanel">...</div>
  <div class="tab-pane" id="messages" role="tabpanel">...</div>
  <div class="tab-pane" id="settings" role="tabpanel">...</div>
</div>

<script>
  var firstTabEl = document.querySelector('#myTab a:last-child')
  var firstTab = new bootstrap.Tab(firstTabEl)

  firstTab.show()
</script>

show

Inosarudza chinhu chakapihwa uye inoratidza chakabatana nacho. Chero chimwe chinhu chakambosarudzwa chinova chisina kusarudzwa uye pane chakabatana nacho chinovanzwa. Inodzokera kune anofona tebhu isati yanyatsoratidzwa (semuenzaniso, shown.bs.tabchiitiko chisati chaitika).

  var someListItemEl = document.querySelector('#someListItem')
  var tab = new bootstrap.Tab(someListItemEl)

  tab.show()

kurasa

Inoparadza tebhu yechinhu.

getInstance

Static nzira iyo inokutendera iwe kuti uwane iyo tab muenzaniso yakabatana neiyo DOM chinhu

var triggerEl = document.querySelector('#trigger')
var tab = bootstrap.Tab.getInstance(triggerEl) // Returns a Bootstrap tab instance

getOrCreateInstance

Static method which allows you to get the tab instance associated with a DOM element, or create a new one in case it wasn’t initialized

var triggerEl = document.querySelector('#trigger')
var tab = bootstrap.Tab.getOrCreateInstance(triggerEl) // Returns a Bootstrap tab instance

Events

When showing a new tab, the events fire in the following order:

  1. hide.bs.tab (on the current active tab)
  2. show.bs.tab (on the to-be-shown tab)
  3. hidden.bs.tab (on the previous active tab, the same one as for the hide.bs.tab event)
  4. shown.bs.tab (on the newly-active just-shown tab, the same one as for the show.bs.tab event)

If no tab was already active, the hide.bs.tab and hidden.bs.tab events will not be fired.

Event type Description
show.bs.tab This event fires on tab show, but before the new tab has been shown. Use event.target and event.relatedTarget to target the active tab and the previous active tab (if available) respectively.
shown.bs.tab This event fires on tab show after a tab has been shown. Use event.target and event.relatedTarget to target the active tab and the previous active tab (if available) respectively.
hide.bs.tab This event fires when a new tab is to be shown (and thus the previous active tab is to be hidden). Use event.target and event.relatedTarget to target the current active tab and the new soon-to-be-active tab, respectively.
hidden.bs.tab This event fires after a new tab is shown (and thus the previous active tab is hidden). Use event.target and event.relatedTarget to target the previous active tab and the new active tab, respectively.
var tabElms = document.querySelectorAll('a[data-bs-toggle="list"]')
tabElms.forEach(function(tabElm) {
  tabElm.addEventListener('shown.bs.tab', function (event) {
    event.target // newly activated tab
    event.relatedTarget // previous active tab
  })
}