Trɔ yi nya veviwo gbɔ Trɔ yi docs ƒe mɔfiamewo dzi
Check
in English

Nusiwo wotsɔna ƒua gbe

Trɔ nya siwo ƒo xlãe ƒe nutsyɔtsyɔwo hena kadodowo ƒe xexlẽdzesiwo kple bubuwo ɖeɖefia kple Bootstrap ƒe ƒuƒoƒoa.

Kpɔɖeŋunyagbɔgblɔ

Dropdowns nye toggleable, contextual overlays hena kadodowo ƒe xexlẽdzesiwo ɖeɖefia kple bubuwo. Wowɔ wo be woawɔ nu kple Bootstrap ƒe JavaScript ƒe kpeɖeŋutɔ si le eme. Wotrɔa asi le wo ŋu to asiƒoƒo ɖe wo dzi me, ke menye to asiƒoƒo ɖe wo dzi me o; esia nye nyametsotso si woɖo koŋ wɔ le aɖaŋuwɔwɔ ŋu .

Wotu nusiwo wotsɔna ƒua gbe ɖe ame etɔ̃lia ƒe agbalẽdzraɖoƒe aɖe dzi, si nye Popper , si naa teƒe si wowɔa dɔ le kple nukpɔkpɔ ƒe ʋɔtruwo didi. Kpɔ egbɔ be yede popper.min.js do ŋgɔ na Bootstrap ƒe JavaScript alo zã bootstrap.bundle.min.js/ bootstrap.bundle.jssi me Popper le. Popper mezãna tsɔ ɖoa ​​dropdowns ɖe navbars me togbɔ be abe dynamic positioning mehiã o ene.

Mɔnukpɔkpɔwo ƒe Mɔnukpɔkpɔ

WAI ARIA ƒe dzidzenu ɖe role="menu"​​widget ŋutɔŋutɔ gɔme , gake esia nye menu siwo le abe dɔwɔwɔ ene siwo ʋãa nuwɔna alo dɔwɔwɔwo koŋ. ARIA ƒe nuɖuɖuwo ate ŋu anye nusiwo le menu me, aɖaka me nu siwo le aɖaka me, radio ƒe abɔta ƒe nuɖuɖu ƒe akpawo, radio ƒe abɔta ƒe ƒuƒoƒo, kple menu suewo ko.

Gake wowɔ Bootstrap ƒe dropdowns ya be woanye esiwo wozãna le mɔ vovovowo nu eye woate ŋu azã wo ɖe nɔnɔme vovovowo kple dzesideɖoɖowo me. Le kpɔɖeŋu me, anya wɔ be woawɔ nusiwo woatsɔ ade eme siwo me nyatakaka bubuwo kple agbalẽviwo dzi kpɔkpɔ le, abe didiƒewo alo agbalẽvi siwo dzi woato age ɖe eme ene. Le susu sia ta la, Bootstrap mekpɔ mɔ (alo tsɔe kpe ɖe eŋu le eɖokui si) rolekple aria-nɔnɔme siwo hiã na ARIA ƒe nuɖuɖu vavãwo dometɔ aɖeke o. Ele be agbalẽŋlɔlawo ŋutɔ nade nɔnɔme siawo siwo le tẽ wu la eme.

Ke hã, Bootstrap tsɔa kpekpeɖeŋu si wotu ɖe eme kpena ɖe keyboard menu ƒe kadodo siwo wozãna ɖaa ƒe akpa gãtɔ ŋu, abe ŋutete si le ame si be wòaʋu to .dropdown-itemnu ɖekaɖekawo me to cursor keys zazã me eye nàtu menu la kple ESCkey la ene.

Kpɔɖeŋuwo

Kpe fli si le fli dzi ƒe toggle (wò abɔta alo kadodo) kple nu si le fli dzi la ɖe .dropdown, alo nu bubu si ɖe gbeƒã position: relative;. Woate ŋu aʋã dropdowns tso <a>alo <button>elements be wòasɔ ɖe wò nuhiahiã siwo ate ŋu adzɔ nu nyuie wu. Kpɔɖeŋu siwo woɖe fia le afisia zãa gɔmesese ƒe <ul>akpawo le afisi wòsɔ le, gake wodoa alɔ dzesidede tɔxɛ.

Abɔta ɖeka

Woateŋu atrɔ ɖekaɖeka ɖesiaɖe .btnwòazu dropdown toggle kple dzesidede tɔtrɔ aɖewo. Alesi nàte ŋu atsɔ wo ade dɔwɔwɔ me kple nu eveawo dometɔ ɖesiaɖee nye esi <button>:

html
<div class="dropdown">
  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    Dropdown button
  </button>
  <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>
  </ul>
</div>

Eye kple <a>nu veviwo:

html
<div class="dropdown">
  <a class="btn btn-secondary dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
    Dropdown link
  </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>
  </ul>
</div>

Akpa nyuitɔ kekeakee nye be àte ŋu awɔ esia kple button variant ɖesiaɖe, hã:

<!-- Example single danger button -->
<div class="btn-group">
  <button type="button" class="btn btn-danger dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    Action
  </button>
  <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>
</div>

Mamã ƒe dzesi

Nenema ke wɔ split button dropdowns kple dzeside ɖeka kloe abe button ɖeka dropdowns ene, gake nàtsɔe akpe ɖe eŋu .dropdown-toggle-splithena dometsotso nyuitɔ ƒo xlã dropdown caret la.

Míezãa klass bubu sia tsɔ ɖea horizontal paddingsi le caret la ƒe akpa eveawo dzi kpɔtɔna 25% eye míeɖea margin-leftthat’s added for regular button dropdowns ɖa. Tɔtrɔ mawo kpee la nana caret la nɔa titina le abɔta si woma la me eye wònaa teƒe si woate ŋu aƒoe si ƒe lolome sɔ wu le abɔta gã la xa.

<!-- Example split danger button -->
<div class="btn-group">
  <button type="button" class="btn btn-danger">Action</button>
  <button type="button" class="btn btn-danger dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    <span class="visually-hidden">Toggle Dropdown</span>
  </button>
  <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>
</div>

Sizing ƒe lolome

Abɔta siwo le tsia dzi la wɔa dɔ kple abɔta siwo ƒe lolome le vovovo, siwo dometɔ aɖewoe nye abɔta siwo woɖo ɖi kple esiwo woma ɖe akpa vovovowo me.

<!-- Large button groups (default and split) -->
<div class="btn-group">
  <button class="btn btn-secondary btn-lg dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    Large button
  </button>
  <ul class="dropdown-menu">
    ...
  </ul>
</div>
<div class="btn-group">
  <button class="btn btn-secondary btn-lg" type="button">
    Large split button
  </button>
  <button type="button" class="btn btn-lg btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    <span class="visually-hidden">Toggle Dropdown</span>
  </button>
  <ul class="dropdown-menu">
    ...
  </ul>
</div>
<div class="btn-group">
  <button class="btn btn-secondary btn-sm dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    Small button
  </button>
  <ul class="dropdown-menu">
    ...
  </ul>
</div>
<div class="btn-group">
  <button class="btn btn-secondary btn-sm" type="button">
    Small split button
  </button>
  <button type="button" class="btn btn-sm btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    <span class="visually-hidden">Toggle Dropdown</span>
  </button>
  <ul class="dropdown-menu">
    ...
  </ul>
</div>

Viviti ƒe ʋuʋudediwo

Tiae ɖe fli siwo do viviti wu me be wòasɔ kple navbar si do viviti alo atsyã tɔxɛ aɖe to etsɔtsɔ kpe .dropdown-menu-darkɖe esi li xoxo .dropdown-menuŋu me. Mehiã be woawɔ tɔtrɔ aɖeke le nusiwo le fli dzi ŋu o.

html
<div class="dropdown">
  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    Dropdown button
  </button>
  <ul class="dropdown-menu dropdown-menu-dark">
    <li><a class="dropdown-item active" 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>
</div>

Eye etsɔtsɔ de navbar me be woazãe:

html
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
  <div class="container-fluid">
    <a class="navbar-brand" href="#">Navbar</a>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDarkDropdown" aria-controls="navbarNavDarkDropdown" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarNavDarkDropdown">
      <ul class="navbar-nav">
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
            Dropdown
          </a>
          <ul class="dropdown-menu dropdown-menu-dark">
            <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>
          </ul>
        </li>
      </ul>
    </div>
  </div>
</nav>

Mɔfiamewo

RTL

Mɔfiamewo dzena le ahuhɔ̃e me ne wole Bootstrap zãm le RTL me, gɔmesese .dropstartadze le ɖusime.

Le titina

Na nu siwo le tsia dzi la nanɔ titina le toggle la te kple .dropdown-centerle dzila ƒe akpaa dzi.

html
<div class="dropdown-center">
  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    Centered dropdown
  </button>
  <ul class="dropdown-menu">
    <li><a class="dropdown-item" href="#">Action</a></li>
    <li><a class="dropdown-item" href="#">Action two</a></li>
    <li><a class="dropdown-item" href="#">Action three</a></li>
  </ul>
</div>

Dropup ƒe ʋuʋu

Dze nu siwo le fli dzi la gɔme le elementwo tame to etsɔtsɔ kpe .dropupɖe dzila ƒe akpaa ŋu me.

<!-- Default dropup button -->
<div class="btn-group dropup">
  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    Dropup
  </button>
  <ul class="dropdown-menu">
    <!-- Dropdown menu links -->
  </ul>
</div>

<!-- Split dropup button -->
<div class="btn-group dropup">
  <button type="button" class="btn btn-secondary">
    Split dropup
  </button>
  <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    <span class="visually-hidden">Toggle Dropdown</span>
  </button>
  <ul class="dropdown-menu">
    <!-- Dropdown menu links -->
  </ul>
</div>

Dropup si le titina

Na dropup menu la nanɔ titina le toggle la tame kple .dropup-centerle dzila ƒe akpaa dzi.

html
<div class="dropup-center dropup">
  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    Centered dropup
  </button>
  <ul class="dropdown-menu">
    <li><a class="dropdown-item" href="#">Action</a></li>
    <li><a class="dropdown-item" href="#">Action two</a></li>
    <li><a class="dropdown-item" href="#">Action three</a></li>
  </ul>
</div>

Dropend ƒe ƒuƒoƒo

Dze nusiwo le fli dzi le elementawo ƒe ɖusime to tsɔtsɔ kpe .dropendɖe dzila element la ŋu me.

<!-- Default dropend button -->
<div class="btn-group dropend">
  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    Dropend
  </button>
  <ul class="dropdown-menu">
    <!-- Dropdown menu links -->
  </ul>
</div>

<!-- Split dropend button -->
<div class="btn-group dropend">
  <button type="button" class="btn btn-secondary">
    Split dropend
  </button>
  <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    <span class="visually-hidden">Toggle Dropend</span>
  </button>
  <ul class="dropdown-menu">
    <!-- Dropdown menu links -->
  </ul>
</div>

Dropstart ƒe gɔmedzedze

Dze nusiwo le fli dzi le elementawo ƒe miame to tsɔtsɔ kpe .dropstartɖe dzila element la ŋu me.

<!-- Default dropstart button -->
<div class="btn-group dropstart">
  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    Dropstart
  </button>
  <ul class="dropdown-menu">
    <!-- Dropdown menu links -->
  </ul>
</div>

<!-- Split dropstart button -->
<div class="btn-group dropstart">
  <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    <span class="visually-hidden">Toggle Dropstart</span>
  </button>
  <ul class="dropdown-menu">
    <!-- Dropdown menu links -->
  </ul>
  <button type="button" class="btn btn-secondary">
    Split dropstart
  </button>
</div>

Àte ŋu azã <a>alo <button>elements abe nusiwo le fli dzi ene.

html
<div class="dropdown">
  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    Dropdown
  </button>
  <ul class="dropdown-menu">
    <li><button class="dropdown-item" type="button">Action</button></li>
    <li><button class="dropdown-item" type="button">Another action</button></li>
    <li><button class="dropdown-item" type="button">Something else here</button></li>
  </ul>
</div>

Àte ŋu awɔ nusiwo mewɔa dɔ kple wo nɔewo o hã kple .dropdown-item-text. Miate ŋu awɔ atsyã geɖe wu faa kple CSS alo nuŋɔŋlɔ ƒe dɔwɔnu siwo wowɔ ɖe ɖoɖo nu.

html
<ul class="dropdown-menu">
  <li><span class="dropdown-item-text">Dropdown item text</span></li>
  <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>
</ul>

Le dɔwɔm

Tsɔe kpe .activeɖe nusiwo le fli si le fli dzi la ŋu be nàwɔ woƒe atsyã be wole dɔ wɔm . Be nàtsɔ nɔnɔme si le dɔ wɔm la ayi kpekpeɖeŋu mɔ̃ɖaŋunuwo gbɔ la, zã aria-currentnɔnɔmea — zã pageasixɔxɔa na axa si li fifia, alo truena nu si li fifia le ƒuƒoƒo aɖe me.

html
<ul class="dropdown-menu">
  <li><a class="dropdown-item" href="#">Regular link</a></li>
  <li><a class="dropdown-item active" href="#" aria-current="true">Active link</a></li>
  <li><a class="dropdown-item" href="#">Another link</a></li>
</ul>

Si me woɖe dzo le

Tsɔe kpe .disabledɖe nusiwo le fli si le fli dzi la ŋu be nàwɔ woƒe atsyã abe nuwɔametɔwo ene .

html
<ul class="dropdown-menu">
  <li><a class="dropdown-item" href="#">Regular link</a></li>
  <li><a class="dropdown-item disabled">Disabled link</a></li>
  <li><a class="dropdown-item" href="#">Another link</a></li>
</ul>

Le gɔmedzedzea me la, woɖoa nusiwo le tsia dzi la ɖe teƒe si le eɖokui si 100% tso etame kple edzila ƒe miame. Àteŋu atrɔ esia kple mɔfiame .drop*ƒe klasswo, gake àteŋu akpɔ wo dzi kple tɔtrɔ ƒe klass bubuwo hã.

Tsɔ kpe .dropdown-menu-endɖe a .dropdown-menuŋu yi ɖusime ɖo fli si le fli dzi la ɖe ɖoɖo nu. Mɔfiamewo dzena le ahuhɔ̃e me ne wole Bootstrap zãm le RTL me, gɔmesese .dropdown-menu-endadze le miame.

Tawo yi dzi! Woɖoa dropdowns ɖe teƒe ɖeka akpe na Popper negbe ne wole navbar me ko.
html
<div class="btn-group">
  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    Right-aligned menu example
  </button>
  <ul class="dropdown-menu dropdown-menu-end">
    <li><button class="dropdown-item" type="button">Action</button></li>
    <li><button class="dropdown-item" type="button">Another action</button></li>
    <li><button class="dropdown-item" type="button">Something else here</button></li>
  </ul>
</div>

Ðoɖowɔwɔ ɖe ɖoɖo nu

Ne èdi be yeazã ɖoɖowɔwɔ ɖe ɖoɖo nu la, wɔ ɖoɖo si trɔna la nuwɔametɔe to nɔnɔmea tsɔtsɔ kpee me data-bs-display="static"eye nàzã ŋuɖoɖo ƒe tɔtrɔ ƒe hatsotsowo.

Ne èdi be yeaɖo fli si le fli dzi la ɖe ɖusime kple breakpoint si wona alo esi lolo wu la, tsɔ kpe ɖe eŋu .dropdown-menu{-sm|-md|-lg|-xl|-xxl}-end.

html
<div class="btn-group">
  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" data-bs-display="static" aria-expanded="false">
    Left-aligned but right aligned when large screen
  </button>
  <ul class="dropdown-menu dropdown-menu-lg-end">
    <li><button class="dropdown-item" type="button">Action</button></li>
    <li><button class="dropdown-item" type="button">Another action</button></li>
    <li><button class="dropdown-item" type="button">Something else here</button></li>
  </ul>
</div>

Ne èdi be yeaɖo miame ƒe fli si le fli dzi la ɖe ɖoɖo nu kple breakpoint si wona alo esi lolo wu la, tsɔ .dropdown-menu-endkple .dropdown-menu{-sm|-md|-lg|-xl|-xxl}-start.

html
<div class="btn-group">
  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" data-bs-display="static" aria-expanded="false">
    Right-aligned but left aligned when large screen
  </button>
  <ul class="dropdown-menu dropdown-menu-end dropdown-menu-lg-start">
    <li><button class="dropdown-item" type="button">Action</button></li>
    <li><button class="dropdown-item" type="button">Another action</button></li>
    <li><button class="dropdown-item" type="button">Something else here</button></li>
  </ul>
</div>

De dzesii be mehiã be nàtsɔ data-bs-display="static"nɔnɔme aɖe akpe ɖe ʋuƒo siwo le navbarwo me ŋu o, elabena womezãa Popper le navbarwo me o.

Tiatia siwo woawɔ ɖe ɖoɖo nu

Ne míexɔ tiatia siwo woɖe fia le etame la ƒe akpa gãtɔ la, nuɖaƒe ƒe tsinyegoe ƒe wɔwɔfia sue aɖee nye esi si me woɖea tiatia vovovo siwo wotsɔna ɖoa fli dzi le teƒe ɖeka.

html
<div class="btn-group">
  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    Dropdown
  </button>
  <ul class="dropdown-menu">
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
  </ul>
</div>

<div class="btn-group">
  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    Right-aligned menu
  </button>
  <ul class="dropdown-menu dropdown-menu-end">
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
  </ul>
</div>

<div class="btn-group">
  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" data-bs-display="static" aria-expanded="false">
    Left-aligned, right-aligned lg
  </button>
  <ul class="dropdown-menu dropdown-menu-lg-end">
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
  </ul>
</div>

<div class="btn-group">
  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" data-bs-display="static" aria-expanded="false">
    Right-aligned, left-aligned lg
  </button>
  <ul class="dropdown-menu dropdown-menu-end dropdown-menu-lg-start">
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
  </ul>
</div>

<div class="btn-group dropstart">
  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    Dropstart
  </button>
  <ul class="dropdown-menu">
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
  </ul>
</div>

<div class="btn-group dropend">
  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    Dropend
  </button>
  <ul class="dropdown-menu">
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
  </ul>
</div>

<div class="btn-group dropup">
  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    Dropup
  </button>
  <ul class="dropdown-menu">
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
  </ul>
</div>

Tanyawo

Tsɔ tanya kpee be nàde dzesi nuwɔna ƒe akpawo le nu ɖesiaɖe si le fli dzi me.

html
<ul class="dropdown-menu">
  <li><h6 class="dropdown-header">Dropdown header</h6></li>
  <li><a class="dropdown-item" href="#">Action</a></li>
  <li><a class="dropdown-item" href="#">Another action</a></li>
</ul>

Amewo mamãnuwo

Tsɔ numamãnu ɖe ​​nuɖuɖu siwo do ƒome kple wo nɔewo ƒe ƒuƒoƒowo me.

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

Nuŋɔɖi

Da nuŋɔŋlɔ ɖesiaɖe si le ablɔɖe me ɖe menu si dzi woŋlɔ nu ɖo la me eye nàzã dometsotso ƒe dɔwɔnuwo . De dzesii be anɔ eme be àhiã lolome ƒe atsyã bubuwo be nàxe mɔ ɖe nuɖuɖua ƒe kekeme nu.

html
<div class="dropdown-menu p-4 text-muted" style="max-width: 200px;">
  <p>
    Some example text that's free-flowing within the dropdown menu.
  </p>
  <p class="mb-0">
    And this is more example text.
  </p>
</div>

Kpekpeɖeŋugbalẽviwo

De agbalẽvi aɖe nu siwo le fli dzi la me, alo nàwɔe wòazu nu siwo le fli dzi, eye nàzã margin alo padding utilities atsɔ ana teƒe manyomanyo si nèhiã lae.

html
<div class="dropdown-menu">
  <form class="px-4 py-3">
    <div class="mb-3">
      <label for="exampleDropdownFormEmail1" class="form-label">Email address</label>
      <input type="email" class="form-control" id="exampleDropdownFormEmail1" placeholder="[email protected]">
    </div>
    <div class="mb-3">
      <label for="exampleDropdownFormPassword1" class="form-label">Password</label>
      <input type="password" class="form-control" id="exampleDropdownFormPassword1" placeholder="Password">
    </div>
    <div class="mb-3">
      <div class="form-check">
        <input type="checkbox" class="form-check-input" id="dropdownCheck">
        <label class="form-check-label" for="dropdownCheck">
          Remember me
        </label>
      </div>
    </div>
    <button type="submit" class="btn btn-primary">Sign in</button>
  </form>
  <div class="dropdown-divider"></div>
  <a class="dropdown-item" href="#">New around here? Sign up</a>
  <a class="dropdown-item" href="#">Forgot password?</a>
</div>
html
<div class="dropdown">
  <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false" data-bs-auto-close="outside">
    Dropdown form
  </button>
  <form class="dropdown-menu p-4">
    <div class="mb-3">
      <label for="exampleDropdownFormEmail2" class="form-label">Email address</label>
      <input type="email" class="form-control" id="exampleDropdownFormEmail2" placeholder="[email protected]">
    </div>
    <div class="mb-3">
      <label for="exampleDropdownFormPassword2" class="form-label">Password</label>
      <input type="password" class="form-control" id="exampleDropdownFormPassword2" placeholder="Password">
    </div>
    <div class="mb-3">
      <div class="form-check">
        <input type="checkbox" class="form-check-input" id="dropdownCheck2">
        <label class="form-check-label" for="dropdownCheck2">
          Remember me
        </label>
      </div>
    </div>
    <button type="submit" class="btn btn-primary">Sign in</button>
  </form>
</div>

data-bs-offsetalo data-bs-referencenàtsɔ atrɔ teƒe si nàɖe nu le.

html
<div class="d-flex">
  <div class="dropdown me-1">
    <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false" data-bs-offset="10,20">
      Offset
    </button>
    <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>
    </ul>
  </div>
  <div class="btn-group">
    <button type="button" class="btn btn-secondary">Reference</button>
    <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false" data-bs-reference="parent">
      <span class="visually-hidden">Toggle Dropdown</span>
    </button>
    <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>
  </div>
</div>

Auto close nuwɔna

Le gɔmedzedzea me la, wotua nusiwo le fli dzi la ne èzi nu siwo le tsia dzi la me alo egodo dzi. Àte ŋu azã autoClosetiatia la atsɔ atrɔ nuwɔna sia si le fli dzi.

html
<div class="btn-group">
  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" data-bs-auto-close="true" aria-expanded="false">
    Default dropdown
  </button>
  <ul class="dropdown-menu">
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
  </ul>
</div>

<div class="btn-group">
  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" data-bs-auto-close="inside" aria-expanded="false">
    Clickable outside
  </button>
  <ul class="dropdown-menu">
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
  </ul>
</div>

<div class="btn-group">
  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false">
    Clickable inside
  </button>
  <ul class="dropdown-menu">
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
  </ul>
</div>

<div class="btn-group">
  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" data-bs-auto-close="false" aria-expanded="false">
    Manual close
  </button>
  <ul class="dropdown-menu">
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
    <li><a class="dropdown-item" href="#">Menu item</a></li>
  </ul>
</div>

CSS ƒe ƒuƒoƒo

Nusiwo trɔna

Wotsɔe kpe ɖe eŋu le v5.2.0 me

Abe Bootstrap ƒe CSS tɔtrɔwo ƒe mɔnu si le tɔtrɔm ƒe akpa aɖe ene la, fifia nusiwo wotsɔna tsia tre ɖe wo nɔewo ŋu zãa teƒea ƒe CSS tɔtrɔwo le .dropdown-menuhena ɣeyiɣi ŋutɔŋutɔ ƒe tɔtrɔwo ƒe ŋgɔyiyi si nyo wu. Woɖo asixɔxɔwo na CSS ƒe tɔtrɔwo to Sass dzi, eyata Sass ƒe tɔtrɔwɔwɔ gakpɔtɔ doa alɔ, hã.

  --#{$prefix}dropdown-zindex: #{$zindex-dropdown};
  --#{$prefix}dropdown-min-width: #{$dropdown-min-width};
  --#{$prefix}dropdown-padding-x: #{$dropdown-padding-x};
  --#{$prefix}dropdown-padding-y: #{$dropdown-padding-y};
  --#{$prefix}dropdown-spacer: #{$dropdown-spacer};
  @include rfs($dropdown-font-size, --#{$prefix}dropdown-font-size);
  --#{$prefix}dropdown-color: #{$dropdown-color};
  --#{$prefix}dropdown-bg: #{$dropdown-bg};
  --#{$prefix}dropdown-border-color: #{$dropdown-border-color};
  --#{$prefix}dropdown-border-radius: #{$dropdown-border-radius};
  --#{$prefix}dropdown-border-width: #{$dropdown-border-width};
  --#{$prefix}dropdown-inner-border-radius: #{$dropdown-inner-border-radius};
  --#{$prefix}dropdown-divider-bg: #{$dropdown-divider-bg};
  --#{$prefix}dropdown-divider-margin-y: #{$dropdown-divider-margin-y};
  --#{$prefix}dropdown-box-shadow: #{$dropdown-box-shadow};
  --#{$prefix}dropdown-link-color: #{$dropdown-link-color};
  --#{$prefix}dropdown-link-hover-color: #{$dropdown-link-hover-color};
  --#{$prefix}dropdown-link-hover-bg: #{$dropdown-link-hover-bg};
  --#{$prefix}dropdown-link-active-color: #{$dropdown-link-active-color};
  --#{$prefix}dropdown-link-active-bg: #{$dropdown-link-active-bg};
  --#{$prefix}dropdown-link-disabled-color: #{$dropdown-link-disabled-color};
  --#{$prefix}dropdown-item-padding-x: #{$dropdown-item-padding-x};
  --#{$prefix}dropdown-item-padding-y: #{$dropdown-item-padding-y};
  --#{$prefix}dropdown-header-color: #{$dropdown-header-color};
  --#{$prefix}dropdown-header-padding-x: #{$dropdown-header-padding-x};
  --#{$prefix}dropdown-header-padding-y: #{$dropdown-header-padding-y};
  

Woateŋu akpɔ tɔtrɔwɔwɔ to CSS tɔtrɔwo dzi le .dropdown-menu-darkklass la dzi afisi míeɖea asixɔxɔ tɔxɛwo ɖa le evɔ míetsɔa CSS tiatiawɔla siwo wogbugbɔ ŋlɔ kpena ɖe eŋu o.

  --#{$prefix}dropdown-color: #{$dropdown-dark-color};
  --#{$prefix}dropdown-bg: #{$dropdown-dark-bg};
  --#{$prefix}dropdown-border-color: #{$dropdown-dark-border-color};
  --#{$prefix}dropdown-box-shadow: #{$dropdown-dark-box-shadow};
  --#{$prefix}dropdown-link-color: #{$dropdown-dark-link-color};
  --#{$prefix}dropdown-link-hover-color: #{$dropdown-dark-link-hover-color};
  --#{$prefix}dropdown-divider-bg: #{$dropdown-dark-divider-bg};
  --#{$prefix}dropdown-link-hover-bg: #{$dropdown-dark-link-hover-bg};
  --#{$prefix}dropdown-link-active-color: #{$dropdown-dark-link-active-color};
  --#{$prefix}dropdown-link-active-bg: #{$dropdown-dark-link-active-bg};
  --#{$prefix}dropdown-link-disabled-color: #{$dropdown-dark-link-disabled-color};
  --#{$prefix}dropdown-header-color: #{$dropdown-dark-header-color};
  

Sass ƒe tɔtrɔwo

Trɔtrɔwo na nusiwo katã le tsia dzi:

$dropdown-min-width:                10rem;
$dropdown-padding-x:                0;
$dropdown-padding-y:                .5rem;
$dropdown-spacer:                   .125rem;
$dropdown-font-size:                $font-size-base;
$dropdown-color:                    $body-color;
$dropdown-bg:                       $white;
$dropdown-border-color:             var(--#{$prefix}border-color-translucent);
$dropdown-border-radius:            $border-radius;
$dropdown-border-width:             $border-width;
$dropdown-inner-border-radius:      subtract($dropdown-border-radius, $dropdown-border-width);
$dropdown-divider-bg:               $dropdown-border-color;
$dropdown-divider-margin-y:         $spacer * .5;
$dropdown-box-shadow:               $box-shadow;

$dropdown-link-color:               $gray-900;
$dropdown-link-hover-color:         shade-color($dropdown-link-color, 10%);
$dropdown-link-hover-bg:            $gray-200;

$dropdown-link-active-color:        $component-active-color;
$dropdown-link-active-bg:           $component-active-bg;

$dropdown-link-disabled-color:      $gray-500;

$dropdown-item-padding-y:           $spacer * .25;
$dropdown-item-padding-x:           $spacer;

$dropdown-header-color:             $gray-600;
$dropdown-header-padding-x:         $dropdown-item-padding-x;
$dropdown-header-padding-y:         $dropdown-padding-y;
// fusv-disable
$dropdown-header-padding:           $dropdown-header-padding-y $dropdown-header-padding-x; // Deprecated in v5.2.0
// fusv-enable

Trɔtrɔwo na viviti ƒe ʋuʋudedi :

$dropdown-dark-color:               $gray-300;
$dropdown-dark-bg:                  $gray-800;
$dropdown-dark-border-color:        $dropdown-border-color;
$dropdown-dark-divider-bg:          $dropdown-divider-bg;
$dropdown-dark-box-shadow:          null;
$dropdown-dark-link-color:          $dropdown-dark-color;
$dropdown-dark-link-hover-color:    $white;
$dropdown-dark-link-hover-bg:       rgba($white, .15);
$dropdown-dark-link-active-color:   $dropdown-link-active-color;
$dropdown-dark-link-active-bg:      $dropdown-link-active-bg;
$dropdown-dark-link-disabled-color: $gray-500;
$dropdown-dark-header-color:        $gray-500;

Trɔtrɔwo na CSS-dzi carets siwo fiaa dropdown ƒe nuwɔwɔ aduadu:

$caret-width:                 .3em;
$caret-vertical-align:        $caret-width * .85;
$caret-spacing:               $caret-width * .85;

Nusiwo wotsɔ tsakae

Wozãa mixins tsɔ wɔa carets siwo wotu ɖe CSS dzi eye woate ŋu akpɔe le scss/mixins/_caret.scss.

@mixin caret-down {
  border-top: $caret-width solid;
  border-right: $caret-width solid transparent;
  border-bottom: 0;
  border-left: $caret-width solid transparent;
}

@mixin caret-up {
  border-top: 0;
  border-right: $caret-width solid transparent;
  border-bottom: $caret-width solid;
  border-left: $caret-width solid transparent;
}

@mixin caret-end {
  border-top: $caret-width solid transparent;
  border-right: 0;
  border-bottom: $caret-width solid transparent;
  border-left: $caret-width solid;
}

@mixin caret-start {
  border-top: $caret-width solid transparent;
  border-right: $caret-width solid;
  border-bottom: $caret-width solid transparent;
}

@mixin caret($direction: down) {
  @if $enable-caret {
    &::after {
      display: inline-block;
      margin-left: $caret-spacing;
      vertical-align: $caret-vertical-align;
      content: "";
      @if $direction == down {
        @include caret-down();
      } @else if $direction == up {
        @include caret-up();
      } @else if $direction == end {
        @include caret-end();
      }
    }

    @if $direction == start {
      &::after {
        display: none;
      }

      &::before {
        display: inline-block;
        margin-right: $caret-spacing;
        vertical-align: $caret-vertical-align;
        content: "";
        @include caret-start();
      }
    }

    &:empty::after {
      margin-left: 0;
    }
  }
}

Zãzã

To data attributes alo JavaScript dzi la, plugin la trɔa nya ɣaɣlawo (nu siwo le fli dzi) to asitɔtrɔ le .showklass la ŋu le dzila la dzi .dropdown-menu. Woɖoa data-bs-toggle="dropdown"ŋu ɖe nɔnɔmea ŋu hena nutsotso siwo le fli dzi le dɔwɔwɔ ƒe ɖoɖo aɖe dzi, eyata anyo be nàzãe ɣesiaɣi.

Le mɔ̃ siwo ŋu woate ŋu aka asi nu ŋu le dzi la, ne èʋu nusi le tsia dzi la, etsɔa asiléƒe ƒuƒluwo kpena ɖe element mouseoverla ƒe vi siwo te ɖe wo ŋu la ŋu. <body>This admittedly ugly hack is necessary to work around a quirk in iOS’ event delegation , si ne menye nenema o la, axe mɔ na tap le afisiafi le dropdown la godo be wòagaʋã code si xea dropdown la o. Ne wonya tu nusi wotsɔna ƒua gbe la ko la, woɖea asiléƒe ƒuƒlu siawo siwo wotsɔ kpe ɖe eŋu mouseoverla ɖa.

To nyatakaka ƒe nɔnɔmewo dzi

Tsɔe kpe data-bs-toggle="dropdown"ɖe kadodo alo abɔta ŋu be nàtrɔ asi le nya aɖe ŋu.

<div class="dropdown">
  <button type="button" data-bs-toggle="dropdown" aria-expanded="false">
    Dropdown trigger
  </button>
  <ul class="dropdown-menu">
    ...
  </ul>
</div>

To JavaScript dzi

Yɔ nusiwo le fli dzi la to JavaScript dzi:

const dropdownElementList = document.querySelectorAll('.dropdown-toggle')
const dropdownList = [...dropdownElementList].map(dropdownToggleEl => new bootstrap.Dropdown(dropdownToggleEl))
data-bs-toggle="dropdown"wogahiã kokoko

Eɖanye be èyɔ wò dropdown la to JavaScript dzi alo nèzã data-api boŋ o, data-bs-toggle="dropdown"ehiã ɣesiaɣi be nànɔ dropdown la ƒe trigger element la dzi.

Tiatiawɔblɔɖewo

Esi woateŋu atsɔ tiatiawɔnuwo ato nyatakaka nɔnɔmewo alo JavaScript dzi ta la, àteŋu atsɔ tiatia ŋkɔ akpe ɖe data-bs-, abe alesi wòle le data-bs-animation="{value}". Kpɔ egbɔ be yetrɔ tiatia ŋkɔa ƒe case type tso “ camelCase ” yi “ kebab-case ” ne èle tiatiaawo tom to data attributes dzi. Le kpɔɖeŋu me, zãe data-bs-custom-class="beautifier"ɖe data-bs-customClass="beautifier".

Tso Bootstrap 5.2.0 dzi la, akpaawo katã doa alɔ dodokpɔ ƒe nyatakaka si wodzra ɖo ƒe nɔnɔme data-bs-configsi ateŋu axɔ akpa ƒe ɖoɖo bɔbɔe abe JSON ka ene. Ne element aɖe si data-bs-config='{"delay":0, "title":123}'kple data-bs-title="456"nɔnɔmewo le la, asixɔxɔ mamlɛtɔ titleanye 456eye nyatakaka nɔnɔme vovovoawo axɔ asixɔxɔ siwo wona le data-bs-config. Tsɔ kpe ɖe eŋu la, nyatakaka ƒe nɔnɔme siwo li fifia te ŋu tsɔa JSON ƒe asixɔxɔwo abe data-bs-delay='{"show":0,"hide":150}'.

Ŋkɔ Ƒomevi Gᴐmedzeƒe Nuɖᴐɖᴐ
autoClose boolean, kaƒoƒo true Trɔ asi le auto close nuwɔna si le dropdown la ŋu:
  • true- woatu nusi le tsia dzi la to asiƒoƒo ɖe gota alo eme le nu si le fli dzi la me.
  • false- woatu fli si le fli dzi la to asiƒoƒo ɖe toggle ƒe dzesi dzi eye nàyɔ hidealo togglemɔnu kple asi. (Azɔ hã womaxee ne èzi escsafuia dzi o)
  • 'inside'- woatu nusi le tsia dzi la (ko) to asiƒoƒo ɖe nusiwo le tsia dzi la me.
  • 'outside'- woatu fli si le tsia dzi la (ko) to asiƒoƒo ɖe nu siwo le tsia dzi la godo me.
De dzesii: woate ŋu atsɔ ESCsafuia axe nusi le tsia dzi la ɣesiaɣi.
boundary ka, nu vevi aɖe 'clippingParents' Overflow mɔxexeɖenu liƒo na dropdown menu (eku ɖe Popper ƒe preventOverflow modifier ko ŋu). Le gɔmedzedzea me la, enye clippingParentseye ateŋu axɔ HTMLElement ƒe nufiame (to JavaScript ɖeɖeko dzi). Ne èdi nyatakaka bubuwo la, kpɔ Popper ƒe detectOverflow docs .
display ka 'dynamic' Le gɔmedzedzea me la, míezãa Popper hena teƒeɖoɖo si trɔna. Tsɔ esia wɔ dɔe kple static.
offset array, ka, dɔwɔwɔ [0, 2] Offset of the dropdown ne wotsɔe sɔ kple eƒe taɖodzinu. Àteŋu atsɔ ka aɖe ayi nyatakaka nɔnɔmewo me kple asixɔxɔ siwo woɖe ɖe vovo le domedome abe: data-bs-offset="10,20". Ne wozã dɔwɔwɔ aɖe tsɔ nya offset la, woyɔnɛ kple nusi me popper ƒe ɖoɖo, nufiame, kple popper rects le abe eƒe nyaʋiʋli gbãtɔ ene. Wotsɔa nusi ʋãa nu DOM node la toa eme abe nyaʋiʋli evelia ene. Ele be dɔwɔwɔa natrɔ ƒuƒoƒo si me xexlẽdzesi eve le: skidding , distance . Ne èdi nyatakaka bubuwo la, kpɔ Popper ƒe offset docs .
popperConfig null, nu, dɔwɔwɔ null Ne èdi be yeatrɔ Bootstrap ƒe Popper ƒe ɖoɖowɔɖi gbãtɔ la, kpɔ Popper ƒe ɖoɖowɔɖi . Ne wozã dɔwɔwɔ aɖe tsɔ wɔ Popper ƒe ɖoɖowɔɖi la, woyɔnɛ kple nusi me Bootstrap ƒe Popper ƒe ɖoɖowɔɖi gbãtɔ le. Ekpena ɖe ŋuwò nèzãa default la eye nàtsɔe aƒo ƒu kple wò ŋutɔ wò ɖoɖowɔɖi. Ele be dɔwɔwɔa natrɔ ɖoɖowɔɖi ƒe nu aɖe na Popper.
reference ka, nu vevi, nu 'toggle' Nufiame ƒe akpa si le nusiwo le fli dzi la me. Xɔ asixɔxɔ siwo le 'toggle', 'parent', HTMLElement ƒe nufiame alo nusi naa getBoundingClientRect. Ne èdi nyatakaka bubuwo la, kpɔ Popper ƒe constructor docs kple virtual element docs .

Zã dɔwɔwɔ kplepopperConfig

const dropdown = new bootstrap.Dropdown(element, {
  popperConfig(defaultBsPopperConfig) {
    // const newPopperConfig = {...}
    // use defaultBsPopperConfig if needed...
    // return newPopperConfig
  }
})

Mɔnuwo

Nuwɔmɔnu Nuɖᴐɖᴐ
dispose Egblẽa nu le element aɖe ƒe dropdown ŋu. (Eɖea nyatakaka siwo wodzra ɖo ɖe DOM ƒe akpaa dzi ɖa)
getInstance Static mɔnu si ɖea mɔ na wò be nàxɔ dropdown instance si do ƒome kple DOM element aɖe, àteŋu azãe ale: bootstrap.Dropdown.getInstance(element).
getOrCreateInstance Static mɔnu si trɔa dropdown instance si do ƒome kple DOM element alo wɔa yeye nenye be womedze egɔme o. Àte ŋu azãe ale: bootstrap.Dropdown.getOrCreateInstance(element).
hide Ɣla navbar alo tabbed navigation si wona ƒe menu si le tsia dzi.
show Fia navbar alo tabbed navigation si wona ƒe menu si le tsia dzi.
toggle Trɔa navbar alo tabbed navigation aɖe si wona la ƒe dropdown menu.
update Trɔ asi le element aɖe ƒe dropdown ƒe nɔƒe ŋu.

Nudzɔdzɔwo

Wodaa nudzɔdzɔ siwo katã le tsia dzi la ɖe toggling element la dzi eye emegbe wowɔa bubbled up. Eyata àteŋu atsɔ nudzɔdzɔ ƒe toɖolawo hã akpe ɖe .dropdown-menu's dzila ƒe akpaa ŋu. hide.bs.dropdowneye hidden.bs.dropdownnudzɔdzɔwo ƒe nɔnɔme aɖe le wo si clickEvent(ne Nudzɔdzɔ ƒomevi gbãtɔ nye click) si me Nudzɔdzɔ ƒe Nu le na nudzɔdzɔ si wozi.

Nudzɔdzɔ ƒomevi Nuɖᴐɖᴐ
hide.bs.dropdown Dzoa enumake ne woyɔ hideinstance mɔnu la.
hidden.bs.dropdown Wodoa dzo ne wowu dropdown la ɣla ɖe zãla la nu eye CSS ƒe tɔtrɔwo wu enu.
show.bs.dropdown Dzoa enumake ne woyɔ showinstance mɔnu la.
shown.bs.dropdown Woɖea dzo ne wowɔ dropdown la be wòadze na zãla eye CSS ƒe tɔtrɔwo wu enu.
const myDropdown = document.getElementById('myDropdown')
myDropdown.addEventListener('show.bs.dropdown', event => {
  // do something...
})