mirror of
https://github.com/mdbootstrap/mdb-ui-kit.git
synced 2024-11-16 06:37:02 +03:00
157 lines
6.9 KiB
HTML
157 lines
6.9 KiB
HTML
|
<div class="bs-docs-section">
|
||
|
<h1 id="dropdowns" class="page-header">Dropdowns</h1>
|
||
|
|
||
|
<p class="lead">Toggleable, contextual menu for displaying lists of links. Made interactive with the <a href="../javascript/#dropdowns">dropdown JavaScript plugin</a>.</p>
|
||
|
|
||
|
<h2 id="dropdowns-example">Example</h2>
|
||
|
<p>Wrap the dropdown's trigger and the dropdown menu within <code>.dropdown</code>, or another element that declares <code>position: relative;</code>. Then add the menu's HTML.</p>
|
||
|
<div class="bs-example" data-example-id="static-dropdown">
|
||
|
<div class="dropdown clearfix">
|
||
|
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||
|
Dropdown
|
||
|
<span class="caret"></span>
|
||
|
</button>
|
||
|
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
||
|
<li><a href="#">Action</a></li>
|
||
|
<li><a href="#">Another action</a></li>
|
||
|
<li><a href="#">Something else here</a></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div><!-- /example -->
|
||
|
{% highlight html %}
|
||
|
<div class="dropdown">
|
||
|
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||
|
Dropdown
|
||
|
<span class="caret"></span>
|
||
|
</button>
|
||
|
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
||
|
<li><a href="#">Action</a></li>
|
||
|
<li><a href="#">Another action</a></li>
|
||
|
<li><a href="#">Something else here</a></li>
|
||
|
<li role="separator" class="divider"></li>
|
||
|
<li><a href="#">Separated link</a></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
{% endhighlight %}
|
||
|
|
||
|
<p>Dropdown menus can be changed to expand upwards (instead of downwards) by adding <code>.dropup</code> to the parent.</p>
|
||
|
<div class="bs-example" data-example-id="static-dropup">
|
||
|
<div class="dropup clearfix">
|
||
|
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||
|
Dropup
|
||
|
<span class="caret"></span>
|
||
|
</button>
|
||
|
<ul class="dropdown-menu" aria-labelledby="dropdownMenu2">
|
||
|
<li><a href="#">Action</a></li>
|
||
|
<li><a href="#">Another action</a></li>
|
||
|
<li><a href="#">Something else here</a></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div><!-- /example -->
|
||
|
{% highlight html %}
|
||
|
<div class="dropup">
|
||
|
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||
|
Dropup
|
||
|
<span class="caret"></span>
|
||
|
</button>
|
||
|
<ul class="dropdown-menu" aria-labelledby="dropdownMenu2">
|
||
|
<li><a href="#">Action</a></li>
|
||
|
<li><a href="#">Another action</a></li>
|
||
|
<li><a href="#">Something else here</a></li>
|
||
|
<li role="separator" class="divider"></li>
|
||
|
<li><a href="#">Separated link</a></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
{% endhighlight %}
|
||
|
|
||
|
<h2 id="dropdowns-alignment">Alignment</h2>
|
||
|
<p>By default, a dropdown menu is automatically positioned 100% from the top and along the left side of its parent. Add <code>.dropdown-menu-right</code> to a <code>.dropdown-menu</code> to right align the dropdown menu.</p>
|
||
|
<div class="bs-callout bs-callout-warning" id="callout-dropdown-positioning">
|
||
|
<h4>May require additional positioning</h4>
|
||
|
<p>Dropdowns are automatically positioned via CSS within the normal flow of the document. This means dropdowns may be cropped by parents with certain <code>overflow</code> properties or appear out of bounds of the viewport. Address these issues on your own as they arise.</p>
|
||
|
</div>
|
||
|
<div class="bs-callout bs-callout-warning" id="callout-dropdown-pull-right">
|
||
|
<h4>Deprecated <code>.pull-right</code> alignment</h4>
|
||
|
<p>As of v3.1.0, we've deprecated <code>.pull-right</code> on dropdown menus. To right-align a menu, use <code>.dropdown-menu-right</code>. Right-aligned nav components in the navbar use a mixin version of this class to automatically align the menu. To override it, use <code>.dropdown-menu-left</code>.</p>
|
||
|
</div>
|
||
|
{% highlight html %}
|
||
|
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dLabel">
|
||
|
...
|
||
|
</ul>
|
||
|
{% endhighlight %}
|
||
|
|
||
|
<h2 id="dropdowns-headers">Headers</h2>
|
||
|
<p>Add a header to label sections of actions in any dropdown menu.</p>
|
||
|
<div class="bs-example">
|
||
|
<div class="dropdown clearfix">
|
||
|
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu3" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||
|
Dropdown
|
||
|
<span class="caret"></span>
|
||
|
</button>
|
||
|
<ul class="dropdown-menu" aria-labelledby="dropdownMenu3">
|
||
|
<li class="dropdown-header">Dropdown header</li>
|
||
|
<li><a href="#">Action</a></li>
|
||
|
<li><a href="#">Another action</a></li>
|
||
|
<li><a href="#">Something else here</a></li>
|
||
|
<li class="dropdown-header">Dropdown header</li>
|
||
|
<li><a href="#">Separated link</a></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div><!-- /example -->
|
||
|
{% highlight html %}
|
||
|
<ul class="dropdown-menu" aria-labelledby="dropdownMenu3">
|
||
|
...
|
||
|
<li class="dropdown-header">Dropdown header</li>
|
||
|
...
|
||
|
</ul>
|
||
|
{% endhighlight %}
|
||
|
|
||
|
<h2 id="dropdowns-divider">Divider</h2>
|
||
|
<p>Add a divider to separate series of links in a dropdown menu.</p>
|
||
|
<div class="bs-example">
|
||
|
<div class="dropdown clearfix">
|
||
|
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenuDivider" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||
|
Dropdown
|
||
|
<span class="caret"></span>
|
||
|
</button>
|
||
|
<ul class="dropdown-menu" aria-labelledby="dropdownMenuDivider">
|
||
|
<li><a href="#">Action</a></li>
|
||
|
<li><a href="#">Another action</a></li>
|
||
|
<li><a href="#">Something else here</a></li>
|
||
|
<li role="separator" class="divider"></li>
|
||
|
<li><a href="#">Separated link</a></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div><!-- /example -->
|
||
|
{% highlight html %}
|
||
|
<ul class="dropdown-menu" aria-labelledby="dropdownMenuDivider">
|
||
|
...
|
||
|
<li role="separator" class="divider"></li>
|
||
|
...
|
||
|
</ul>
|
||
|
{% endhighlight %}
|
||
|
|
||
|
<h2 id="dropdowns-disabled">Disabled menu items</h2>
|
||
|
<p>Add <code>.disabled</code> to a <code><li></code> in the dropdown to disable the link.</p>
|
||
|
<div class="bs-example">
|
||
|
<div class="dropdown clearfix">
|
||
|
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu4" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||
|
Dropdown
|
||
|
<span class="caret"></span>
|
||
|
</button>
|
||
|
<ul class="dropdown-menu" aria-labelledby="dropdownMenu4">
|
||
|
<li><a href="#">Regular link</a></li>
|
||
|
<li class="disabled"><a href="#">Disabled link</a></li>
|
||
|
<li><a href="#">Another link</a></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div><!-- /example -->
|
||
|
{% highlight html %}
|
||
|
<ul class="dropdown-menu" aria-labelledby="dropdownMenu4">
|
||
|
<li><a href="#">Regular link</a></li>
|
||
|
<li class="disabled"><a href="#">Disabled link</a></li>
|
||
|
<li><a href="#">Another link</a></li>
|
||
|
</ul>
|
||
|
{% endhighlight %}
|
||
|
</div>
|