Saltar al contenido principal Salta a docs navegación
Check
in English

Navs y pestañas

Qillqakuna chaymanta ejemplokuna imayna Bootstrap kaqpa churasqa puriy componentekuna llamk'achinapaq.

Base nav

Navegación Bootstrap kaqpi tarikuq general marcayta chaymanta estilokuna qunakuy, base .navclasemanta ruwasqa chaymanta mana atisqa estadokunaman. Sapa estilopura tikranapaq tikraq clasekunata tikray.

Componente base .navflexbox kaqwan ruwasqa chaymanta huk sinchi cimientota qun tukuy laya componentes de navegación ruwanapaq. Wakin estilo llallichiykunata (listakunawan llamk'anapaq), wakin t'inki hunt'achiyta aswan hatun tupachiy áreas kaqpaq, chaymanta sapsi mana atichisqa estilota yapan.

Componente base .navnisqapiqa manam ima .activeestadotapas churanchu. Kay qatiq ejemplokunan claseta churanku, aswantaqa kay clase particular mana ima estilo especialtapas llank’achisqanmanta rikuchinapaq.

Yanapakuq tecnologiakunaman ruwana estadota apachinapaq, aria-currentlaya llamk'achiy — pagekunan p'anqapaq chanin llamk'achispa, utaq truekunan kaq imapaq huk huñupi.

html nisqapi
<ul class="nav">
  <li class="nav-item">
    <a class="nav-link active" aria-current="page" href="#">Active</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#">Link</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#">Link</a>
  </li>
  <li class="nav-item">
    <a class="nav-link disabled">Disabled</a>
  </li>
</ul>

Clases tukuyninpi llamk'achisqa kanku, chayrayku marcasqayki super flexible kanman. Utilizar <ul>s como arriba, <ol>si el orden de tus artículos es importante, o rollo tu propio con un <nav>elemento. Imaraykuchus chay .navllamk'achiykuna display: flex, nav t'inkikuna kikinta purinku imaynachus nav elementokuna ruwanku, ichaqa mana chay yapasqa markawan.

html nisqapi
<nav class="nav">
  <a class="nav-link active" aria-current="page" href="#">Active</a>
  <a class="nav-link" href="#">Link</a>
  <a class="nav-link" href="#">Link</a>
  <a class="nav-link disabled">Disabled</a>
</nav>

Estilos disponibles

Cambiar el estilo de .navs componente con modificadores y utilidades. Necesitasqaykiman hina chaqruspa tupachiy, utaq qampaq ruway.

Alineación horizontal nisqa

Nav kaqniykipa horizontal chiqanchayta flexbox yanapakuykunawan tikray . Ñawpaqmanta, navs lluq'iman chiqanchasqa kanku, ichataq chawpiman icha pañaman chiqanchasqaman mana sasachakuspa tikrayta atinki.

Chawpichasqa kaykunawan .justify-content-center:

html nisqapi
<ul class="nav justify-content-center">
  <li class="nav-item">
    <a class="nav-link active" aria-current="page" href="#">Active</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#">Link</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#">Link</a>
  </li>
  <li class="nav-item">
    <a class="nav-link disabled">Disabled</a>
  </li>
</ul>

Paña-allichasqa kaywan .justify-content-end:

html nisqapi
<ul class="nav justify-content-end">
  <li class="nav-item">
    <a class="nav-link active" aria-current="page" href="#">Active</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#">Link</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#">Link</a>
  </li>
  <li class="nav-item">
    <a class="nav-link disabled">Disabled</a>
  </li>
</ul>

Sayanpa

.flex-columnNavegaciónniyki pilay flex elemento direccionta utilidadwan tikraspa . ¿Necesitas apilarlos en algunos puertos de vistas pero no otros? Kutichiq layakunata llamk'achiy (kayhina, .flex-sm-column).

html nisqapi
<ul class="nav flex-column">
  <li class="nav-item">
    <a class="nav-link active" aria-current="page" href="#">Active</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#">Link</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#">Link</a>
  </li>
  <li class="nav-item">
    <a class="nav-link disabled">Disabled</a>
  </li>
</ul>

Sapa kuti hina, sayaq puriyqa atikunmi mana <ul>s nisqawanpas.

html nisqapi
<nav class="nav flex-column">
  <a class="nav-link active" aria-current="page" href="#">Active</a>
  <a class="nav-link" href="#">Link</a>
  <a class="nav-link" href="#">Link</a>
  <a class="nav-link disabled">Disabled</a>
</nav>

Pestañas

Hawamanta nav básica kaqmanta hapin chaymanta .nav-tabsclaseta yapan huk tabbed interfaz ruwanapaq. Chaykunata llamk'achiy tablakuna ruwanapaq tabla JavaScript plugin nisqaykuwan .

html nisqapi
<ul class="nav nav-tabs">
  <li class="nav-item">
    <a class="nav-link active" aria-current="page" href="#">Active</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#">Link</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#">Link</a>
  </li>
  <li class="nav-item">
    <a class="nav-link disabled">Disabled</a>
  </li>
</ul>

Pastillas

Chay kikin HTML nisqallata hap'iy, ichataq .nav-pillschaypa rantinpi llamk'achiy:

html nisqapi
<ul class="nav nav-pills">
  <li class="nav-item">
    <a class="nav-link active" aria-current="page" href="#">Active</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#">Link</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#">Link</a>
  </li>
  <li class="nav-item">
    <a class="nav-link disabled">Disabled</a>
  </li>
</ul>

Llenar y justificar

Kallpanchay qampaq .nav's contenidokuna hunt'asqa tarikuq anchota huk iskay tikraq clasekunamanta mast'arinanpaq. Llapan kaq espaciota .nav-items nisqaykiwan proporcionalmente hunt’anaykipaqqa .nav-fill. Reparay llapa horizontal espacio ocupasqa kasqanmanta, ichaqa manan sapa nav elemento kaqlla anchoyoqchu.

html nisqapi
<ul class="nav nav-pills nav-fill">
  <li class="nav-item">
    <a class="nav-link active" aria-current="page" href="#">Active</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#">Much longer nav link</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#">Link</a>
  </li>
  <li class="nav-item">
    <a class="nav-link disabled">Disabled</a>
  </li>
</ul>

-manta ruwasqa puriyta llamk'achkaspa <nav>, mana manchakuspa saqiyta atikunki imaynachus elementokuna estilopaq .nav-itemsapalla .nav-linkmañakun hina .<a>

html nisqapi
<nav class="nav nav-pills nav-fill">
  <a class="nav-link active" aria-current="page" href="#">Active</a>
  <a class="nav-link" href="#">Much longer nav link</a>
  <a class="nav-link" href="#">Link</a>
  <a class="nav-link disabled">Disabled</a>
</nav>

Igual anchoyuq elementokunapaqqa .nav-justified. Llapan horizontal espacio nav t'inkikunawan hap'isqa kanqa, ichataq mana .nav-fillhawapi hinachu, sapa nav elemento kaqlla anchoyuq kanqa.

html nisqapi
<ul class="nav nav-pills nav-justified">
  <li class="nav-item">
    <a class="nav-link active" aria-current="page" href="#">Active</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#">Much longer nav link</a>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#">Link</a>
  </li>
  <li class="nav-item">
    <a class="nav-link disabled">Disabled</a>
  </li>
</ul>

-based navigation .nav-fillllamk'achispa ejemploman rikch'akuq .<nav>

html nisqapi
<nav class="nav nav-pills nav-justified">
  <a class="nav-link active" aria-current="page" href="#">Active</a>
  <a class="nav-link" href="#">Much longer nav link</a>
  <a class="nav-link" href="#">Link</a>
  <a class="nav-link disabled">Disabled</a>
</nav>

Flex utilidadkunawan llamk’ay

Sichus kutichiq nav variaciones kaqmanta necesitanki, huk serie flexbox yanapakuykunata llamk'achiyta yuyaykuy . Aswan verbose kaqtinpas, kay yanapakuykuna aswan hatun ruwayta qunku tukuy kutichiq p'akiykunapi. Uraypi kaq rikch'anapi, navniyku aswan pisi p'akiypi pilasqa kanqa, chaymanta huk horizontal churayman adaptakunqa mayqinchus tarikuq anchota hunt'achin huch'uy p'akiymanta qallarispa.

html nisqapi
<nav class="nav nav-pills flex-column flex-sm-row">
  <a class="flex-sm-fill text-sm-center nav-link active" aria-current="page" href="#">Active</a>
  <a class="flex-sm-fill text-sm-center nav-link" href="#">Longer nav link</a>
  <a class="flex-sm-fill text-sm-center nav-link" href="#">Link</a>
  <a class="flex-sm-fill text-sm-center nav-link disabled">Disabled</a>
</nav>

Accesibilidad nisqamanta

Sichus navs llamk'achkanki huk purina barra qunapaq, ama hina kaspa huk role="navigation"aswan lógico tayta waqaychanaman yapay chaymanta <ul>, utaq huk <nav>elementota tukuy puriypa muyuriqninpi p'istuy. Ama ruwayta <ul>kikinman yapaychu, kayqa hark'anmanmi yanapaq tecnologiakuna chiqap lista hina willasqa kananpaq.

Reparay puriy barrakuna, qhawaypi estiloyuq kaptinpas .nav-tabsclasewan tablakuna hina, mana qusqachu kanan tiyan , role="tablist"utaq role="tab"atributos role="tabpanel". Kaykunaqa dinámico tablayuq interfazkunallapaq allin kanku, imaynachus ARIA Qillqana Ruwaykuna yanapakuy tablakuna patrón kaqpi willasqa . Rikuy JavaScript ruwayta huk rikch'anapaq kay t'aqapi dinamico tabbed interfaces kaqpaq. Atributo mana necesariochu interfaces dinámicas tablado kaqpi JavaScriptniyku akllasqa estadota ruwan ruwaq tablapi aria-currentyapaspa .aria-selected="true"

Utilizando los desplegables

Yanapakuy urayk'aq menúkuna huk pisi yapasqa HTML kaqwan chaymanta urayk'aq JavaScript plugin kaqwan .

Pestañas con desplegables

html nisqapi
<ul class="nav nav-tabs">
  <li class="nav-item">
    <a class="nav-link active" aria-current="page" href="#">Active</a>
  </li>
  <li class="nav-item dropdown">
    <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">Dropdown</a>
    <ul class="dropdown-menu">
      <li><a class="dropdown-item" href="#">Action</a></li>
      <li><a class="dropdown-item" href="#">Another action</a></li>
      <li><a class="dropdown-item" href="#">Something else here</a></li>
      <li><hr class="dropdown-divider"></li>
      <li><a class="dropdown-item" href="#">Separated link</a></li>
    </ul>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#">Link</a>
  </li>
  <li class="nav-item">
    <a class="nav-link disabled">Disabled</a>
  </li>
</ul>

Pastillas con caídas

html nisqapi
<ul class="nav nav-pills">
  <li class="nav-item">
    <a class="nav-link active" aria-current="page" href="#">Active</a>
  </li>
  <li class="nav-item dropdown">
    <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">Dropdown</a>
    <ul class="dropdown-menu">
      <li><a class="dropdown-item" href="#">Action</a></li>
      <li><a class="dropdown-item" href="#">Another action</a></li>
      <li><a class="dropdown-item" href="#">Something else here</a></li>
      <li><hr class="dropdown-divider"></li>
      <li><a class="dropdown-item" href="#">Separated link</a></li>
    </ul>
  </li>
  <li class="nav-item">
    <a class="nav-link" href="#">Link</a>
  </li>
  <li class="nav-item">
    <a class="nav-link disabled">Disabled</a>
  </li>
</ul>

CSS nisqa

Variables nisqakuna

v5.2.0 nisqapi yapasqa

Bootstrap kaqpa wiñaq CSS tikraqkuna asuykuyninmanta huknin hina, navs kunan llaqta CSS tikraqkunata .nav, .nav-tabs, kaqpi chaymanta .nav-pillschiqa pacha ruwanapaq kallpachasqa llamk'achinku. CSS tikraqkunapaq chanikuna Sass kaqnintakama churasqa, chayrayku Sass ruwanakuna yanapasqaraq kachkan, chaymanta.

Clase .navbase nisqapi:

  --#{$prefix}nav-link-padding-x: #{$nav-link-padding-x};
  --#{$prefix}nav-link-padding-y: #{$nav-link-padding-y};
  @include rfs($nav-link-font-size, --#{$prefix}nav-link-font-size);
  --#{$prefix}nav-link-font-weight: #{$nav-link-font-weight};
  --#{$prefix}nav-link-color: #{$nav-link-color};
  --#{$prefix}nav-link-hover-color: #{$nav-link-hover-color};
  --#{$prefix}nav-link-disabled-color: #{$nav-link-disabled-color};
  

Tikraq .nav-tabsclasemanta:

  --#{$prefix}nav-tabs-border-width: #{$nav-tabs-border-width};
  --#{$prefix}nav-tabs-border-color: #{$nav-tabs-border-color};
  --#{$prefix}nav-tabs-border-radius: #{$nav-tabs-border-radius};
  --#{$prefix}nav-tabs-link-hover-border-color: #{$nav-tabs-link-hover-border-color};
  --#{$prefix}nav-tabs-link-active-color: #{$nav-tabs-link-active-color};
  --#{$prefix}nav-tabs-link-active-bg: #{$nav-tabs-link-active-bg};
  --#{$prefix}nav-tabs-link-active-border-color: #{$nav-tabs-link-active-border-color};
  

Tikraq .nav-pillsclasemanta:

  --#{$prefix}nav-pills-border-radius: #{$nav-pills-border-radius};
  --#{$prefix}nav-pills-link-active-color: #{$nav-pills-link-active-color};
  --#{$prefix}nav-pills-link-active-bg: #{$nav-pills-link-active-bg};
  

Sass variables nisqakuna

$nav-link-padding-y:                .5rem;
$nav-link-padding-x:                1rem;
$nav-link-font-size:                null;
$nav-link-font-weight:              null;
$nav-link-color:                    var(--#{$prefix}link-color);
$nav-link-hover-color:              var(--#{$prefix}link-hover-color);
$nav-link-transition:               color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out;
$nav-link-disabled-color:           $gray-600;

$nav-tabs-border-color:             $gray-300;
$nav-tabs-border-width:             $border-width;
$nav-tabs-border-radius:            $border-radius;
$nav-tabs-link-hover-border-color:  $gray-200 $gray-200 $nav-tabs-border-color;
$nav-tabs-link-active-color:        $gray-700;
$nav-tabs-link-active-bg:           $body-bg;
$nav-tabs-link-active-border-color: $gray-300 $gray-300 $nav-tabs-link-active-bg;

$nav-pills-border-radius:           $border-radius;
$nav-pills-link-active-color:       $component-active-color;
$nav-pills-link-active-bg:          $component-active-bg;

JavaScript nisqap ruwaynin

JavaScript plugin tablata llamk'achiy —sapallan utaq huñusqa bootstrap.jswillañiqi kaqnintakama churay— purina tablakunayku chaymanta pastillakunayku mast'ariypaq tablakuna ruwanakuna kitipi kaqmanta ruwanapaq.

Kayqa wakin tiyanayuq willaymi chay Wasi ñiqipa tinkisqa willaynin. Huk tabla ñit'iyqa kaypa rikuyninta qatiqpaq tikranqa. JavaScript tabla clasekunata t'inkin, contenido rikuy chaymanta estilo kamachiypaq. Chayta llamk'achiy atikunki tablakunawan, pastillakunawan, chaymanta ima wak .nav-wan kallpachasqa puriywanpas.

This is some placeholder content the Profile tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

This is some placeholder content the Contact tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

This is some placeholder content the Disabled tab's associated content.

<ul class="nav nav-tabs" id="myTab" role="tablist">
  <li class="nav-item" role="presentation">
    <button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home-tab-pane" type="button" role="tab" aria-controls="home-tab-pane" aria-selected="true">Home</button>
  </li>
  <li class="nav-item" role="presentation">
    <button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#profile-tab-pane" type="button" role="tab" aria-controls="profile-tab-pane" aria-selected="false">Profile</button>
  </li>
  <li class="nav-item" role="presentation">
    <button class="nav-link" id="contact-tab" data-bs-toggle="tab" data-bs-target="#contact-tab-pane" type="button" role="tab" aria-controls="contact-tab-pane" aria-selected="false">Contact</button>
  </li>
  <li class="nav-item" role="presentation">
    <button class="nav-link" id="disabled-tab" data-bs-toggle="tab" data-bs-target="#disabled-tab-pane" type="button" role="tab" aria-controls="disabled-tab-pane" aria-selected="false" disabled>Disabled</button>
  </li>
</ul>
<div class="tab-content" id="myTabContent">
  <div class="tab-pane fade show active" id="home-tab-pane" role="tabpanel" aria-labelledby="home-tab" tabindex="0">...</div>
  <div class="tab-pane fade" id="profile-tab-pane" role="tabpanel" aria-labelledby="profile-tab" tabindex="0">...</div>
  <div class="tab-pane fade" id="contact-tab-pane" role="tabpanel" aria-labelledby="contact-tab" tabindex="0">...</div>
  <div class="tab-pane fade" id="disabled-tab-pane" role="tabpanel" aria-labelledby="disabled-tab" tabindex="0">...</div>
</div>

Yanapanapaq necesidadniykiman hina, kayqa llamkan <ul>-sapanchasqa markawan, imaynachus patamanta rikuchisqa, utaq mayqin munasqa “kikiykipaq rollo” markawan. Reparay sichus , llamk'achkanki <nav>, mana chiqamanta yapanaykichu tiyan role="tablist", kayqa elementopa nativo ruwayninta puriypa señalnin hina llallichinman. Aswanpas, huk elemento alternativo nisqaman tikray (urapi ejemplopi, huk simple <div>) hinaspa <nav>muyuriqninpi p'istuy.

<nav>
  <div class="nav nav-tabs" id="nav-tab" role="tablist">
    <button class="nav-link active" id="nav-home-tab" data-bs-toggle="tab" data-bs-target="#nav-home" type="button" role="tab" aria-controls="nav-home" aria-selected="true">Home</button>
    <button class="nav-link" id="nav-profile-tab" data-bs-toggle="tab" data-bs-target="#nav-profile" type="button" role="tab" aria-controls="nav-profile" aria-selected="false">Profile</button>
    <button class="nav-link" id="nav-contact-tab" data-bs-toggle="tab" data-bs-target="#nav-contact" type="button" role="tab" aria-controls="nav-contact" aria-selected="false">Contact</button>
    <button class="nav-link" id="nav-disabled-tab" data-bs-toggle="tab" data-bs-target="#nav-disabled" type="button" role="tab" aria-controls="nav-disabled" aria-selected="false" disabled>Disabled</button>
  </div>
</nav>
<div class="tab-content" id="nav-tabContent">
  <div class="tab-pane fade show active" id="nav-home" role="tabpanel" aria-labelledby="nav-home-tab" tabindex="0">...</div>
  <div class="tab-pane fade" id="nav-profile" role="tabpanel" aria-labelledby="nav-profile-tab" tabindex="0">...</div>
  <div class="tab-pane fade" id="nav-contact" role="tabpanel" aria-labelledby="nav-contact-tab" tabindex="0">...</div>
  <div class="tab-pane fade" id="nav-disabled" role="tabpanel" aria-labelledby="nav-disabled-tab" tabindex="0">...</div>
</div>

Tabs pluginpas pastillakunawan llamk’an.

Kayqa wakin tiyanayuq willaymi chay Wasi ñiqipa tinkisqa willaynin. Huk tabla ñit'iyqa kaypa rikuyninta qatiqpaq tikranqa. JavaScript tabla clasekunata t'inkin, contenido rikuy chaymanta estilo kamachiypaq. Chayta llamk'achiy atikunki tablakunawan, pastillakunawan, chaymanta ima wak .nav-wan kallpachasqa puriywanpas.

This is some placeholder content the Profile tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

This is some placeholder content the Contact tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

This is some placeholder content the Disabled tab's associated content.

<ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">
  <li class="nav-item" role="presentation">
    <button class="nav-link active" id="pills-home-tab" data-bs-toggle="pill" data-bs-target="#pills-home" type="button" role="tab" aria-controls="pills-home" aria-selected="true">Home</button>
  </li>
  <li class="nav-item" role="presentation">
    <button class="nav-link" id="pills-profile-tab" data-bs-toggle="pill" data-bs-target="#pills-profile" type="button" role="tab" aria-controls="pills-profile" aria-selected="false">Profile</button>
  </li>
  <li class="nav-item" role="presentation">
    <button class="nav-link" id="pills-contact-tab" data-bs-toggle="pill" data-bs-target="#pills-contact" type="button" role="tab" aria-controls="pills-contact" aria-selected="false">Contact</button>
  </li>
  <li class="nav-item" role="presentation">
    <button class="nav-link" id="pills-disabled-tab" data-bs-toggle="pill" data-bs-target="#pills-disabled" type="button" role="tab" aria-controls="pills-disabled" aria-selected="false" disabled>Disabled</button>
  </li>
</ul>
<div class="tab-content" id="pills-tabContent">
  <div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab" tabindex="0">...</div>
  <div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab" tabindex="0">...</div>
  <div class="tab-pane fade" id="pills-contact" role="tabpanel" aria-labelledby="pills-contact-tab" tabindex="0">...</div>
  <div class="tab-pane fade" id="pills-disabled" role="tabpanel" aria-labelledby="pills-disabled-tab" tabindex="0">...</div>
</div>

Y con pastillas verticales. aria-orientation="vertical"Aswan allinqa, sayaq tablakunapaq, tablakuna lista waqaychanamanpas yapanayki tiyan.

Kayqa wakin tiyanayuq willaymi chay Wasi ñiqipa tinkisqa willaynin. Huk tabla ñit'iyqa kaypa rikuyninta qatiqpaq tikranqa. JavaScript tabla clasekunata t'inkin, contenido rikuy chaymanta estilo kamachiypaq. Chayta llamk'achiy atikunki tablakunawan, pastillakunawan, chaymanta ima wak .nav-wan kallpachasqa puriywanpas.

This is some placeholder content the Profile tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

This is some placeholder content the Disabled tab's associated content.

This is some placeholder content the Messages tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

This is some placeholder content the Settings tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

<div class="d-flex align-items-start">
  <div class="nav flex-column nav-pills me-3" id="v-pills-tab" role="tablist" aria-orientation="vertical">
    <button class="nav-link active" id="v-pills-home-tab" data-bs-toggle="pill" data-bs-target="#v-pills-home" type="button" role="tab" aria-controls="v-pills-home" aria-selected="true">Home</button>
    <button class="nav-link" id="v-pills-profile-tab" data-bs-toggle="pill" data-bs-target="#v-pills-profile" type="button" role="tab" aria-controls="v-pills-profile" aria-selected="false">Profile</button>
    <button class="nav-link" id="v-pills-disabled-tab" data-bs-toggle="pill" data-bs-target="#v-pills-disabled" type="button" role="tab" aria-controls="v-pills-disabled" aria-selected="false" disabled>Disabled</button>
    <button class="nav-link" id="v-pills-messages-tab" data-bs-toggle="pill" data-bs-target="#v-pills-messages" type="button" role="tab" aria-controls="v-pills-messages" aria-selected="false">Messages</button>
    <button class="nav-link" id="v-pills-settings-tab" data-bs-toggle="pill" data-bs-target="#v-pills-settings" type="button" role="tab" aria-controls="v-pills-settings" aria-selected="false">Settings</button>
  </div>
  <div class="tab-content" id="v-pills-tabContent">
    <div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab" tabindex="0">...</div>
    <div class="tab-pane fade" id="v-pills-profile" role="tabpanel" aria-labelledby="v-pills-profile-tab" tabindex="0">...</div>
    <div class="tab-pane fade" id="v-pills-disabled" role="tabpanel" aria-labelledby="v-pills-disabled-tab" tabindex="0">...</div>
    <div class="tab-pane fade" id="v-pills-messages" role="tabpanel" aria-labelledby="v-pills-messages-tab" tabindex="0">...</div>
    <div class="tab-pane fade" id="v-pills-settings" role="tabpanel" aria-labelledby="v-pills-settings-tab" tabindex="0">...</div>
  </div>
</div>

Accesibilidad nisqa

Interfaces de tablas dinámicas, imaynachus ARIA Guía de prácticas de autorización tablas patrón kaqpi willasqa , role="tablist", role="tab", role="tabpanel", chaymanta yapasqa aria-atributokuna mañakunku chaymanta estructurankuta, ruwanankuta chaymanta kunan estadonkuta yanapakuq tecnologiakuna ruwaqkunaman (pantalla ñawiriqkuna hina) chayachinankupaq. Aswan allin ruway hina, <button>elementokuna tablakuna kaqpaq llamk'achiyta yuyaychayku, imaynachus kay kamachiykuna huk tikray tikrayta llamk'achinku, aswan t'inkikuna musuq p'anqaman utaq kitiman puriq.

ARIA Qillqana Ruwaykuna ruwanawan kuska, kunan ruwasqa tablalla teclado enfoqueta chaskikun. JavaScript plugin qallarisqa kaqtin, tabindex="-1"llapa mana ruwasqa tabla kamachiykunapi churanqa. Huk kuti kunan ruwasqa tabla enfoque kaqwan, cursor llavekuna ñawpaq/qhipa tablata llamk'achinku, plugin kaqwan chaymanhina roving tikran . tabindexIchaqa, reparay JavaScript plugin mana t'aqakunchu horizontal chaymanta sayaq tabla listakuna kursor llave interacciones kaqmanta rimaspa: mana imapas tabla lista orientación kaqmanta, iskaynin wichay chaymanta paña kursor ñawpaq tabla kaqman rin, chaymanta uray chaymanta paña kursor rinku qatiqninpi kaq tablapi.

En general, teclado puriyta yanapanapaq, yuyaychakun ruwayta kikin paneles de pestañas enfocables kaqtapas, manachus ñawpaq elemento contenido significativo contenidota panel de pestañas ukhupi hap'inña enfocablesña kachkan. JavaScript plugin mana kay aspecto ruwayta munanchu —maypichus allin, sut'imanta ruwanayki tiyan tabla panelesniyki enfocables kaqta yapaspa marcaykipi tabindex="0".
Tab JavaScript plugin mana yanapanchu tabbed interfaces kaqmanta mayqinkunachus urayk'aq menúkunayuq kanku, imaynachus kay iskaynin llamk'anapaq chaymanta yaykuy atiy sasachakuykunata ruwan. Huk llamk'achiy qhawaymanta, kunan rikuchisqa tablamanta llamk'achiq elemento mana chaylla rikukuq kasqan (imaynachus wichq'asqa urayk'aq menú ukhupi kachkan) pantayta ruwanman. Huk yaykuy atiymanta qhawaymanta, kunan pacha mana kanchu yuyayniyuq ñan kay laya ruwayta huk WAI ARIA patrón estándar kaqman mapa ruwanapaq, niyta munan mana facilta ruwayta atikunmanchu yanapakuq tecnologiakuna llamk'aqkunaman entiendenapaq.

Atributos de datos nisqawan yanapachikuspa

Huk tabla utaq pastilla puriyta mana ima JavaScript qillqaspa llamk'achiyta atikunki huk elemento kaqpi willaylla data-bs-toggle="tab"utaq data-bs-toggle="pill"huk elemento kaqpi. Kay willay layakunata .nav-tabsutaq kaqpi llamk'achiy .nav-pills.

<!-- Nav tabs -->
<ul class="nav nav-tabs" id="myTab" role="tablist">
  <li class="nav-item" role="presentation">
    <button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home" type="button" role="tab" aria-controls="home" aria-selected="true">Home</button>
  </li>
  <li class="nav-item" role="presentation">
    <button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#profile" type="button" role="tab" aria-controls="profile" aria-selected="false">Profile</button>
  </li>
  <li class="nav-item" role="presentation">
    <button class="nav-link" id="messages-tab" data-bs-toggle="tab" data-bs-target="#messages" type="button" role="tab" aria-controls="messages" aria-selected="false">Messages</button>
  </li>
  <li class="nav-item" role="presentation">
    <button class="nav-link" id="settings-tab" data-bs-toggle="tab" data-bs-target="#settings" type="button" role="tab" aria-controls="settings" aria-selected="false">Settings</button>
  </li>
</ul>

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

JavaScript nisqawan

JavaScript kaqnintakama tablakuna ruwanakuna atichiy (sapa tablakuna sapalla llamk'achinan tiyan):

const triggerTabList = document.querySelectorAll('#myTab button')
triggerTabList.forEach(triggerEl => {
  const tabTrigger = new bootstrap.Tab(triggerEl)

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

Sapa tablakunata achka ruwaykunapi llamk'achiyta atikunki:

const triggerEl = document.querySelector('#myTab button[data-bs-target="#profile"]')
bootstrap.Tab.getInstance(triggerEl).show() // Select tab by name

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

Efecto de desvanecer

Pestañakuna chinkananpaqqa, .fadesapakamaman yapay .tab-pane. Ñawpaq kaq tabla panelpas .showqallariy contenido rikukuq kananpaq kanan tiyan.

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

Métodos

Métodos y transiciones asíncronas

Llapan API ruwanakuna mana sink'uyuq kanku chaymanta huk tikrayta qallarinku . Paykunaqa kutinku waqyaqman chaylla transición qallarisqa ichaqa manaraq tukukuchkaptin . Chaymantapas, huk tikray componente kaqpi huk método waqyay mana qhawasqachu kanqa .

Aswan willakuypaq JavaScript qillqaykuta qhaway .

Contenidoykita huk elemento de pestaña hina activan.

Ruraqwan huk tabla instanciata ruwayta atinki, ahinataq:

const bsTab = new bootstrap.Tab('#myTab')
Imayna Willay
dispose Huk elementopa tablanta chinkachin.
getInstance Método estático mayqinchus huk DOM elementowan tinkisqa tab instanciata hap'iyta atikun, kayhinata llamk'achiy atikunki: bootstrap.Tab.getInstance(element).
getOrCreateInstance Método estático mayqinchus huk DOM elementowan tinkisqa tabla instanciata kutichin utaq musuq ruwan mana qallarisqa kaqtin. Chaytaqa kayhinatam servichikuwaq: bootstrap.Tab.getOrCreateInstance(element).
show Qusqa tablata akllan chaymanta tinkisqa panelninta rikuchin. Ima huk tablapas ñawpaq akllasqa karqan mana akllasqaman tukun chaymanta tinkisqa panelnin pakasqa. Llamaqman kutimun manaraq tabla panel chiqamanta rikuchisqa kachkaptin (icha manaraq shown.bs.tabruway ruwakuchkaptin).

Eventos nisqakuna

Musuq tablata rikuchispa, sucesokuna kay ordenpi ninawan:

  1. hide.bs.tab(kunan llamk'aq tablapi)
  2. show.bs.tab(qhawanapaq kaq tablapi)
  3. hidden.bs.tab(ñawpaq ruwaq tablapi, kikin hide.bs.tabruwaypaq)
  4. shown.bs.tab(musuq-ruray chayraq rikuchisqa ñiqipi, kikin show.bs.tabruwaypaq)

Sichus mana mayqin tablapas ruwasqañachu karqan, chaymanta hide.bs.tabchaymanta hidden.bs.tabruwaykuna mana llamk'achisqachu kanqa.

Tipo de evento Willay
hide.bs.tab Kay suceso ninawan mayk'aq huk musuq tabla rikuchisqa kanan tiyan (hinallataq chayhina ñawpaq ruwaq tabla pakasqa kanan tiyan). Utilizar event.targetchaymanta event.relatedTargetkunan ruwasqa tablata chaymanta musuq chaylla llamk'achiq tablata, sapakama.
hidden.bs.tab Kay ruwayqa musuq tabla rikuchisqa kaptin (hinallataq chayhina ñawpaq ruwaq tabla pakasqa kachkan). Utilizar event.targetchaymanta event.relatedTargetñawpaq ruwasqa tablata chaymanta musuq ruwaq tablata targetta ruwanapaq, chaymanta.
show.bs.tab Kay ruwayqa tabla rikuchiypi ninawan, ichaqa manaraq musuq tabla rikuchisqa kachkaptin. Utilizar event.targety event.relatedTargetpara target a la pestaña activa y la pestaña activo anterior (si está disponible) respectivamente.
shown.bs.tab Kay ruwayqa tabla rikuchiypi ninawan huk tabla rikuchisqa kaptin. Utilizar event.targety event.relatedTargetpara target a la pestaña activa y la pestaña activo anterior (si está disponible) respectivamente.
const tabEl = document.querySelector('button[data-bs-toggle="tab"]')
tabEl.addEventListener('shown.bs.tab', event => {
  event.target // newly activated tab
  event.relatedTarget // previous active tab
})