ድሮፕዳውንድስ
ዝርዝር መላግቦታትን ካልእን ንምርኣይ ብBotstrap ንቑልቁል ዝወርድ ፕላግ-ኢን ንዓውደ-ጽሑፋዊ ምድብላቕ ምቕያር።
ሓፈሻዊ ትሕዝቶ
ንቑልቁል ዝወርድ ዝርዝር መላግቦታትን ካልእን ንምርኣይ ዝሕግዙ ተለዋወጥቲ ዝኾኑ፣ ዓውደ-ጽሑፋዊ ምድብላቕ እዮም። በቲ ዝተሓወሶ ቡትስትራፕ ንቑልቁል ዝወርድ ጃቫስክሪፕት ፕላግ-ኢን መስተጋብራዊ ይኾኑ። ብምጥዋቕ እምበር ብምንሳሕ ኣይኮኑን ዝቕየሩ፤ እዚ ኮነ ኢልካ ዝተገብረ ውሳነ ዲዛይን ’ ዩ ።
ድሮፕዳውንስ ኣብ ሳልሳይ ወገን ቤተ-መጻሕፍቲ ዝተሃንጹ ኮይኖም ፡ ፖፐር ፡ ዳይናሚክ ኣቀማምጣን ቪውፖርት ምልላይን ይህብ። ቅድሚ ናይ Bootstrap ጃቫስክሪፕት popper.min.js ምእታውኩም ኣረጋግጹ ወይ ድማ Popper ዝሓዘ bootstrap.bundle.min.js
/ ተጠቐሙ። bootstrap.bundle.js
ፖፐር ዳይናሚክ ኣቀማምጣ ስለዘየድሊ ግን ኣብ navbars ንዝወድቁ ቦታታት ንምቕማጥ ኣይጥቀመሉን እዩ።
ተበጻሕነት
እቲ WAI ARIA ደረጃ ንሓደ ጭቡጥ role="menu"
ዊጀት ይገልጽ , እዚ ግን ንተግባራት ወይ ተግባራት ዝቐስቅሱ መተግበሪ ዝመስሉ ምልክታታት ፍሉይ እዩ። ናይ ARIA ምልክታታት ናይ ምልክት ዝርዝር ነገራት፣ ናይ ምልክት ሳጹን ዝርዝር ነገራት፣ ናይ ሬድዮ መጠወቒ ዝርዝር ነገራት፣ ናይ ሬድዮ መጠወቒ ጉጅለታትን ንኡሳን ምልክታታትን ጥራይ ክሕዙ ይኽእሉ።
ብኣንጻሩ ናይ ቡትስትራፕ ድሮፕዳውንድስ ሓፈሻዊን ንዝተፈላለየ ኩነታትን ማርካፕ ቅርጽታትን ዝምልከትን ክኾኑ ዝተዳለዉ እዮም። ንኣብነት ተወሳኺ እታዎታትን ቁጽጽር ቅጥዕን ዝሓዙ ንቑልቁል ዝወርዱ ነገራት ምፍጣር ይከኣል እዩ፣ ከም ናይ ምድላይ ዓውድታት ወይ ናይ መእተዊ ቅጥዕታት። በዚ ምኽንያት እዚ፡ ቡትስትራፕ ንሓቀኛታት ARIA ምልክታታት ዘድልዩ role
ዝኾነን ባህርያትን ኣይጽበን (ወይ ብኣውቶማቲክ ኣይውስኽን) ። ጸሓፍቲ ነዞም ዝያዳ ፍሉያት ባህርያት ባዕሎም ከካትትዎም ክግደዱ እዮም።aria-
ይኹን እምበር፡ ቡትስትራፕ ንመብዛሕትኡ መደበኛ ናይ ሰሌዳ ቁልፊ ምልክት ምትእስሳር ኣብ ውሽጢ ዝተሃንጸ ደገፍ ይውስኽ እዩ፡ ከም ናይ .dropdown-item
መመልከቲ መፍትሕታት ተጠቒምካ ብውልቀ ባእታታት ናይ ምዝዋርን ነቲ ዝርዝር ESCብመፍትሕ ምዕጻውን ዓቕሚ።
ኣብነታት
ናይቲ ንቑልቁል ዝወርድ ቶግለር (ናትካ መጠወቒ ወይ መላ��ቦ) ከምኡውን ነቲ ንቑልቁል ዝወርድ ዝርዝር ኣብ ውሽጢ .dropdown
፣ ወይ ካልእ ን ዝእውጅ ባእታ ጠቕልሎ position: relative;
። ድሮፕዳውንድ ካብ <a>
ወይ <button>
ባእታታት ክብገሱ ይኽእሉ እዮም ብዝበለጸ ምስ ክህልዉኻ ዝኽእሉ ድሌታት ክሰማምዑ። ኣብዚ ዝተርኣዩ ኣብነታት <ul>
ኣድላዪ ኣብ ዝኾነሉ ትርጉማዊ ባእታታት ይጥቀሙ፣ ግን ብሕታዊ ምልክት ምግባር ይድገፍ።
ንጽል መጠወቒ
ዝኾነ ንጽል .btn
ምስ ገለ ናይ ምልክት ለውጢ ናብ ንቑልቁል ዝወርድ ቶግል ክቕየር ይኽእል። <button>
ብኽልቲኡ ባእታታት ብኸመይ ክትሰርሖም ከም እትኽእል ኣብዚ ኣሎ ፤
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown button
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1">
<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>
ምስ <a>
ባእታታት ድማ፤
<div class="dropdown">
<a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown link
</a>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<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>
እቲ ዝበለጸ ክፋል እዚ ምስ ዝኾነ ናይ መጠወቒ ፍልልይ ክትገብር ትኽእል ኢኻ፣ ንስኻ እውን፤
<!-- 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>
ምፍንጫል ዝብል መጠወቒ
ብተመሳሳሊ፡ ዳርጋ ከም ሓደ መጠወቒ ንቑልቁል ዝወርድ ምልክት ዘለዎም ዝተመቕሉ መጠወቒታት ንቑልቁል ፍጠር፣ ግን ከኣ ኣብ .dropdown-toggle-split
ዙርያ እቲ ንቑልቁል ዝወርድ ካሬት ግቡእ ርሕቀት ንምርካብ ብምውሳኽ።
ነዚ ተወሳኺ ክፍሊ ንጥቀመሉ padding
ኣብ ክልቲኡ ወገን ናይቲ ካሬት ዘሎ ኣግማድ ብ25% ንምንካይን ነቲ margin-left
ንስሩዕ መጠወቒ ምውራድ ዝተወሰኸ ንምእላይን። እቶም ተወሳኺ ለውጥታት ነቲ ካሬት ኣብቲ ዝተመቕለ መጠወቒ ማእከል ገይሩ ይገብርዎን ኣብ ጎኒ እቲ ቀንዲ መጠወቒ ዝያዳ ዝምጥን ዓቐን ዘለዎ ናይ ምውቃዕ ቦታ ይህቡን።
<!-- 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>
ሳይዚንግ ምግባር
ንቑልቁል ዝወርድ መጠወቒታት ምስ ኩሉ ዓቐን ዘለዎም መጠወቒታት ይሰርሑ፣ ነባሪን ዝተመቕሉን ንቑልቁል ዝወርድ መጠወቒታት ሓዊስካ።
<!-- 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>
ጸሊም ንጣብ ንጣብ
ኣብ ዝጸልመተ ናቭባር ወይ ብሕታዊ ቅዲ ንምስምማዕ ኣብ ዝጸልመተ ንቑልቁል ዝወርድ ምረጽ ኣብ .dropdown-menu-dark
ልዕሊ ዝጸንሐ ብምውሳኽ .dropdown-menu
። ኣብቲ ንቑልቁል ዝወርድ ነገራት ዝኾነ ለውጢ ኣየድልን።
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton2" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown button
</button>
<ul class="dropdown-menu dropdown-menu-dark" aria-labelledby="dropdownMenuButton2">
<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>
ከምኡ’ውን ኣብ ናቭባር ንጥቀመሉ ምቕማጥ፤
<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="#" id="navbarDarkDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown
</a>
<ul class="dropdown-menu dropdown-menu-dark" aria-labelledby="navbarDarkDropdownMenuLink">
<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>
ኣንፈታት
RTL
ኣብ RTL Bootstrap ክትጥቀም ከለኻ ኣንፈታት ይንጸባረቑ፣ ማለት .dropstart
ኣብ የማናይ ሸነኽ ክረአ እዩ።
ድሮፕኣፕ
.dropup
ኣብ ልዕሊ ባእታታት ንዘለዉ ንቑልቁል ዝወርድ ምልክታታት ኣብቲ ወላዲ ባእታ ብምውሳኽ ኣበግስ።
<!-- 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>
ድሮፕራይት።
.dropend
ኣብቲ ወላዲ ባእታ ብምውሳኽ ኣብ የማናይ ሸነኽ ናይቶም ባእታታት ዝርከቡ ንቑልቁል ዝወርድ ምልክታታት ኣበግስ ።
<!-- Default dropend button -->
<div class="btn-group dropend">
<button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
Dropright
</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 Dropright</span>
</button>
<ul class="dropdown-menu">
<!-- Dropdown menu links -->
</ul>
</div>
ድሮፕለፍት
.dropstart
ኣብቲ ወላዲ ባእታ ብምውሳኽ ኣብ ጸጋማይ ሸነኽ ናይቶም ባእታታት ዝርከቡ ንቑልቁል ዝወርድ ምልክታታት ጀምር ።
<!-- 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">
<div class="btn-group dropstart" role="group">
<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>
</div>
<button type="button" class="btn btn-secondary">
Split dropstart
</button>
</div>
ናይ ምልክት ዝርዝር ነገራት
<a>
ወይ <button>
ባእታታት ከም ንቑልቁል ዝወርድ ነገራት ክትጥቀመሉ ትኽእል ኢኻ ።
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenu2" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu2">
<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>
ብተወሳኺ ብዘይ መስተጋብራዊ ንቑልቁል ዝወርድ ነገራት ብ .dropdown-item-text
. ብብሕታዊ CSS ወይ ጽሑፍ ዩቲሊቲታት ዝያዳ ቅዲ ክትገብሩ ናጻ ትኾኑ።
<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>
ንቑሕ
.active
ኣብቲ ንቑልቁል ዝወርድ ነገራት ከም ንጡፍ ቅዲ ንምግባር ወስኸሎም ። ነቲ ንጡፍ ኩነታት ናብ ሓገዝቲ ቴክኖሎጂታት ንምትሕልላፍ፡ ነቲ aria-current
ባህሪ ተጠቐም — ነቲ page
ዋጋ ናይቲ ህሉው ገጽ ብምጥቃም፡ ወይ true
ንህሉው ኣቕሓ ኣብ ሓደ ስብስብ።
<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>
ስንኩል
.disabled
ኣብቲ ንቑልቁል ዝወርድ ነገራት ከም ዝተሰናኸሉ ቅዲ ንምግባር ወስኸሎም ።
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Regular link</a></li>
<li><a class="dropdown-item disabled" href="#" tabindex="-1" aria-disabled="true">Disabled link</a></li>
<li><a class="dropdown-item" href="#">Another link</a></li>
</ul>
ኣሰላልፋ ዝርዝር መግቢ
ብነባሪ መልክዑ፡ ሓደ ንቑልቁል ዝወርድ ዝርዝር ብኣውቶማቲክ ካብ ላዕሊን ብጸጋማይ ሸነኽ ወላዲኡን 100% ይቕመጥ። ነዚ ብኣንፈታዊ .drop*
ክፍልታት ክትቅይሮ ትኽእል ኢኻ፣ ግን ብተወሳኺ መቐየሪ ክፍልታት እውን ክትቆጻጸሮም ትኽእል ኢኻ።
.dropdown-menu-end
ናብ a ወስኹ ናብ .dropdown-menu
የማን ነቲ ንቑልቁል ዝወርድ ዝርዝር ኣሰላልፍዎ። ኣብ RTL Bootstrap ክትጥቀም ከለኻ ኣንፈታት ይንጸባረቕ፣ ማለት .dropdown-menu-end
ኣብ ጸጋማይ ሸነኽ ክረአ እዩ።
<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>
ምላሽ ዝህብ ኣሰላልፋ
ምላሽ ዝህብ ኣሰላልፋ ክትጥቀም እንተደሊኻ፡ ነቲ data-bs-display="static"
ባህሪ ብምውሳኽ ዳይናሚክ ኣቀማምጣ ኣሰናኽልን ነቶም ምላሽ ዝህቡ ናይ ለውጢ ክፍልታት ተጠቐምን።
ነቲ ንቑልቁል ዝወርድ ዝርዝር ምስቲ ዝተዋህበ ነጥቢ ምብታኽ ወይ ካብኡ ዝዓቢ ንየማን ንምስምማዕ ፡ ወስኸሉ .dropdown-menu{-sm|-md|-lg|-xl|-xxl}-end
።
<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>
ንጸጋም ነቲ ንቑልቁል ዝወርድ ዝርዝር ምስቲ ዝተዋህበ ነጥቢ ምብታኽ ወይ ካብኡ ዝዓቢ ንምስምማዕ .dropdown-menu-end
፡ ወስኸሉን .dropdown-menu{-sm|-md|-lg|-xl|-xxl}-start
።
<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>
data-bs-display="static"
ፖፐር ኣብ navbars ስለዘይጥቀም፡ ኣብ navbars ንዝርከቡ ንቑልቁል ዝወርድ መጠወቒታት ባህሪ ምውሳኽ ከምዘየድልየካ ኣስተውዕል።
ናይ ኣሰላልፋ ኣማራጺታት
መብዛሕትኦም ኣብ ላዕሊ ዝተገልጹ ኣማራጺታት ብምውሳድ፡ ኣብዚ ንእሽቶ ናይ ክሽነ መሕጸቢ ዲሞ ዝተፈላለዩ ንቑልቁል ዝወርድ ኣሰላልፋ ኣማራጺታት ኣብ ሓደ ቦታ ኣሎ።
<div class="btn-group">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<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>
ትሕዝቶ ዝርዝር መግቢ
ኣርእስታት
ኣብ ዝኾነ ንቑልቁል ዝወርድ ዝርዝር ንክፋላት ተግባራት ስያመ ንምሃብ ርእሲ ምውሳኽ።
<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>
መከፋፈልቲ
ንጉጅለታት ናይ ተዛመድቲ ናይ ምልክት ዝርዝር ነገራት ብመከፋፈልቲ ምፍላይ።
<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 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>
ቅጥዕታት
ንሓደ ቅጥዒ ኣብ ውሽጢ ንቑልቁል ዝወርድ ዝርዝር ኣቐምጦ፣ ወይ ናብ ንቑልቁል ዝወርድ ዝርዝር ግበሮ፣ ከምኡውን ማርጅን ወይ ፓዲንግ ዩቲሊቲታት ተጠቐም እሞ እቲ እትደልዮ ኣሉታዊ ቦታ ሃቦ።
<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>
<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>
ንቑልቁል ዝወርድ ኣማራጺታት
ነቲ ንቑልቁል ዝወርድ ቦታ ንምቕያር data-bs-offset
ወይ ተጠቐም ።data-bs-reference
<div class="d-flex">
<div class="dropdown me-1">
<button type="button" class="btn btn-secondary dropdown-toggle" id="dropdownMenuOffset" data-bs-toggle="dropdown" aria-expanded="false" data-bs-offset="10,20">
Offset
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuOffset">
<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" id="dropdownMenuReference" data-bs-toggle="dropdown" aria-expanded="false" data-bs-reference="parent">
<span class="visually-hidden">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuReference">
<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>
ኣውቶ ምዕጻው ባህሪ
ብነባሪ መልክዑ፡ ኣብ ውሽጢ ወይ ወጻኢ ናይቲ ንቑልቁል ዝወርድ ዝርዝር ክትጥውቕ ከለኻ፡ እቲ ንቑልቁል ዝወርድ ዝርዝር ይዕጾ። autoClose
ነዚ ባህሪ ናይቲ ንቑልቁል ዝወርድ ንምቕያር ነቲ ኣማራጺ ክትጥቀመሉ ትኽእል ኢኻ ።
<div class="btn-group">
<button class="btn btn-secondary dropdown-toggle" type="button" id="defaultDropdown" data-bs-toggle="dropdown" data-bs-auto-close="true" aria-expanded="false">
Default dropdown
</button>
<ul class="dropdown-menu" aria-labelledby="defaultDropdown">
<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" id="dropdownMenuClickableOutside" data-bs-toggle="dropdown" data-bs-auto-close="inside" aria-expanded="false">
Clickable outside
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuClickableOutside">
<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" id="dropdownMenuClickableInside" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false">
Clickable inside
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuClickableInside">
<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" id="dropdownMenuClickable" data-bs-toggle="dropdown" data-bs-auto-close="false" aria-expanded="false">
Manual close
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuClickable">
<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>
ሳስ
ተለዋዋጢ ረቛሒታት
ንኹሎም ንቑልቁል ዝወርድ ተለዋዋጢ ረቛሒታት፤
$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: rgba($black, .15);
$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($gray-900, 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: $dropdown-padding-y $dropdown-item-padding-x;
ተለዋዋጢ ንጸልማት ንቑልቁል ዝወርድ :
$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;
ናይ ሓደ ንቑልቁል ዝወርድ መስተጋብር ዘመልክቱ ተለዋዋጢ ንCSS-based carets፤
$caret-width: .3em;
$caret-vertical-align: $caret-width * .85;
$caret-spacing: $caret-width * .85;
ሚክሲን ዝበሃሉ ምዃኖም ይፍለጥ
ሚክሲን ነቶም ኣብ CSS ዝተመርኮሱ ካረታት ንምፍጣር ዝጥቀሙ ኮይኖም ኣብ 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;
}
}
}
ኣጠቓቕማ
.show
ብመንገዲ ባህርያት ዳታ ወይ ጃቫስክሪፕት፡ እቲ ንቑልቁል ዝወርድ ተወሰኽቲ ነቲ ክፍሊ ኣብቲ ወላዲ ብምቕያር ንዝተሓብአ ትሕዝቶ (ንቑልቁል ዝወርድ ዝርዝር) ይቕይሮ .dropdown-menu
። እቲ data-bs-toggle="dropdown"
ባህሪ ብደረጃ መተግበሪ ንዝርከቡ ንቑልቁል ዝወርድ ምልክታታት ንምዕጻው ዝጽጋዕ እዩ፣ ስለዚ ኩሉ ግዜ ክትጥቀመሉ ጽቡቕ ሓሳብ እዩ።
mouseover
መትሓዚታት ናብቶም ናይ ቀረባ ቆልዑ ናይቲ
<body>
ባእታ ይውስኽ። This admittedly ugly hack is necessary to work around a
quirk in iOS' event delegation , እዚ እንተዘይኮይኑ ካብቲ ንቑልቁል ዝወርድ ወጻኢ ኣብ ዝኾነ ቦታ ምጥዋይ ነቲ ንቑልቁል ዝወርድ ኮድ ካብ ምብጋስ ክኽልክል ምኸኣለ። እቲ ንቑልቁል ዝወርድ ምስ ተዓጽወ፡ እዞም ተወሳኺ ባዶ
mouseover
ዝኾኑ መትሓዚታት ይእለዩ።
ብመንገዲ ባህርያት ዳታ
data-bs-toggle="dropdown"
ንሓደ ንቑልቁል ዝወርድ ንቑልቁል ንምቕያር ናብ ሓደ ሊንክ ወይ መጠወቒ ወስኹ ።
<div class="dropdown">
<button id="dLabel" type="button" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown trigger
</button>
<ul class="dropdown-menu" aria-labelledby="dLabel">
...
</ul>
</div>
ብመንገዲ ጃቫስክሪፕት።
ብመንገዲ ጃቫስክሪፕት ናብቶም ንቑልቁል ዝወርድ ደውሉ፤
var dropdownElementList = [].slice.call(document.querySelectorAll('.dropdown-toggle'))
var dropdownList = dropdownElementList.map(function (dropdownToggleEl) {
return new bootstrap.Dropdown(dropdownToggleEl)
})
data-bs-toggle="dropdown"
ሕጂ’ውን የድሊ ኣሎ።
ንቑልቁል ዝወርድካ ብመንገዲ ጃቫስክሪፕት ትድውለሉ ወይ ኣብ ክንድኡ ነቲ data-api ትጥቀም ብዘየገድስ data-bs-toggle="dropdown"
፡ ኩሉ ግዜ ኣብቲ ንቑልቁል ዝወርድ መበገሲ ባእታ ህልው ክህሉ ይግደድ።
ኣማራጺታት
ኣማራጺታት ብመንገዲ ዳታ ባህርያት ወይ ጃቫስክሪፕት ክሓልፉ ይኽእሉ። ንባህርያት ዳታ፡ ስም ኣማራጺ ናብ ምውሳኽ data-bs-
፡ ከምቲ ኣብ data-bs-offset=""
. ነቶም ኣማራጺታት ብመንገዲ ባህርያት ዳታ ክትሓልፍ ከለኻ፡ ዓይነት ኬዝ ናይቲ ስም ኣማራጺ ካብ camelCase ናብ kebab-case ምቕያርካ ኣረጋግጽ። ንኣብነት ኣብ ክንዲ ንጥቀም data-bs-autoClose="false"
፡ ን ተጠቐም data-bs-auto-close="false"
።
ሽም | ዓይነት | ትሑዝ | መግለፂ |
---|---|---|---|
boundary |
ሕብረ ቃላት | ባእታ | 'clippingParents' |
ናይ ምፍሳስ ደረት ዶብ ናይቲ ንቑልቁል ዝወርድ ዝርዝር (ንናይ ፖፐር preventOverflow መቐየሪ ጥራይ እዩ ዝምልከት)። ብነባሪ 'clippingParents' HTMLElement መወከሲ እዩ (ብጃቫስክሪፕት ጥራይ ኣቢሉ) ክቕበል ይኽእልን ይኽእል። ንዝያዳ ሓበሬታ ኣብ Popper's detectOverflow docs ተወከሱ ። |
reference |
ሕብረ ቃላት | ባእታ | ግኡዝ ነገር | 'toggle' |
መወከሲ ባእታ ናይቲ ንቑልቁል ዝወርድ ዝርዝር። 'toggle' ናይ , 'parent' , ናይ HTMLElement መወከሲ ወይ ናይ ሓደ ነገር ዝህብ ክብርታት ይቕበል getBoundingClientRect ። ንዝያዳ ሓበሬታ ንናይ ፖፐር ሃናጺ ዶክስን ቨርቹዋል ባእታ ዶክስን ተወከሱ ። |
display |
ገመድ | 'dynamic' |
ብነባሪ ንዳይናሚክ ኣቀማምጣ ፖፐር ንጥቀም። ነዚ ብ static . |
offset |
ስርዓት | ሕብረ ቃላት | ተግባር | [0, 2] |
ምትዕርራይ ናይቲ ምውራድ ብተዛማዲ ምስቲ ዕላማኡ። ኣብ ዳታ ባህርያት ብኮማ ዝተፈላለዩ ክብርታት ከምዚ ዝኣመሰለ ሕብረ ቃላት ክትሓልፍ ትኽእል ኢኻ፤ ሓደ ፋንክሽን ነቲ ኦፍሴት ንምውሳን ክጥቀመሉ ከሎ፡ ከም ቀዳማይ ሞጎቱ፡ ፖፐር ኣቀማምጣ፡ መወከሲ፡ ፖፐር ሬክትስን ዝሓዘ ነገር ሒዙ ይጽዋዕ። እቲ መበገሲ ባእታ DOM node ከም ካልኣይ ሞጎተ ይሓልፍ። እቲ ፋንክሽን ክልተ ቁጽርታት ዘለዎ ስርዓት ክመልስ ኣለዎ ፡ . ንዝያዳ ሓበሬታ ኣብ ፖፐር ኦፍሴት ዶክስ ተወከሱ ። |
autoClose |
ቡልያን | ገመድ | true |
ናይቲ ንቑልቁል ዝወርድ ኣውቶማቲክ ምዕጻው ባህሪ ውቅር፤
|
popperConfig |
ባዶ | ኣቕሓ | ተግባር | null |
ናይ ቡትስትራፕ ነባሪ ናይ ፖፐር ውቅር ንምቕያር፡ ናይ ፖፐር ውቅር ርአ ። ሓደ ፋንክሽን ንናይ ፖፐር ውቅር ንምፍጣር ክጥቀመሉ ከሎ፡ ብናይ ቡትስትራፕ ነባሪ ፖፐር ውቅር ዝሓዘ ነገር ይጽዋዕ። ነቲ ነባሪ ምስ ናይ ገዛእ ርእስኻ ውቅር ክትጥቀመሉን ክትወሃሃዶን ይሕግዘካ። እቲ ተግባር ንፖፐር ናይ ውቅር ነገር ክመልስ ኣለዎ። |
ፋንክሽን ምስ ምጥቃምpopperConfig
var dropdown = new bootstrap.Dropdown(element, {
popperConfig: function (defaultBsPopperConfig) {
// var newPopperConfig = {...}
// use defaultBsPopperConfig if needed...
// return newPopperConfig
}
})
ኣገባባት
ሜላ | መግለፂ |
---|---|
toggle |
ናይ ሓደ ዝተዋህበ ናቭባር ወይ ትቦ ዘለዎ ምድህሳስ ንቑልቁል ዝወርድ ዝርዝር ይቕይሮ። |
show |
ናይ ሓደ ዝተዋህበ ናቭባር ወይ ትቦ ዘለዎ ምድህሳስ ንቑልቁል ዝወርድ ዝርዝር የርኢ። |
hide |
ናይ ሓደ ዝተዋህበ ናቭባር ወይ ትቦ ዘለዎ ምድህሳስ ንቑልቁል ዝወርድ ዝርዝር ይሓብእ። |
update |
ናይ ሓደ ባእታ ንቑልቁል ዝወርድ ቦታ ኣቀማምጣ የዘምን። |
dispose |
ናይ ሓደ ባእታ ንቑልቁል ዝወርድ የጥፍኦ። (ኣብ DOM element ዝተዓቀበ ዳታ የወግድ) |
getInstance |
ምስ ሓደ DOM element ዝተኣሳሰር ንቑልቁል ዝወርድ instance ክትረክብ ዘኽእለካ Static method፣ ከምዚ ጌርካ ክትጥቀመሉ ትኽእል ኢኻ፤bootstrap.Dropdown.getInstance(element) |
getOrCreateInstance |
ምስ ሓደ DOM ባእታ ዝተኣሳሰር ንቑልቁል ዝወርድ ምሳሌ ዝምለስ ወይ ድማ ንኸይተጀመረ ሓድሽ ዝፈጥር ስታትቲክ ሜላ። ከምዚ ጌርካ ክትጥቀመሉ ትኽእል ኢኻ፤bootstrap.Dropdown.getOrCreateInstance(element) |
ፍጻሜታት
ኩሎም ንቑልቁል ዝወርድ ፍጻመታት ኣብቲ ዝቕይር ባእታ ይትኮሱ ድሕሪኡ ድማ ይፍንፍሑ። .dropdown-menu
ስለዚ ኣብቲ 's ወላዲ ባእታ ውን ናይ ፍጻመ ሰማዕቲ ክትውስኽ ትኽእል ኢኻ ። hide.bs.dropdown
ከምኡ’ውን hidden.bs.dropdown
ፍጻመታት ንፍጻመ ጠውቂ ዝኸውን Event Object ዝሓዘ clickEvent
ንብረት ኣለዎም (እቲ መበቆላዊ ዓይነት Event ምስ ዝኸውን ጥራይ )።click
ሜላ | መግለፂ |
---|---|
show.bs.dropdown |
እቲ show instance ሜላ ምስ ዝጽዋዕ ብቕጽበት ይትኩስ። |
shown.bs.dropdown |
እቲ ንቑልቁል ዝወርድ ንተጠቃሚ ርኡይ ምስ ዝኸውንን ምስግጋር CSS ምስተዛዘመን ይተኮስ። |
hide.bs.dropdown |
እቲ hide instance method ምስ ተጸውዐ ብቕጽበት ይትኩስ። |
hidden.bs.dropdown |
እቲ ንቑልቁል ዝወርድ ካብ ተጠቃሚ ምሕባእ ምስተወድአን ምስግጋር CSS ምስተዛዘመን ይተኮስ። |
var myDropdown = document.getElementById('myDropdown')
myDropdown.addEventListener('show.bs.dropdown', function () {
// do something...
})