0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00

markdownify button dropdowns

This commit is contained in:
Mark Otto 2014-07-13 01:23:29 -07:00
parent 35d87bcb25
commit 4a5f1f036b

View File

@ -3,80 +3,80 @@ layout: page
title: Button dropdown title: Button dropdown
--- ---
<div class="bs-docs-section"> Use any button to trigger a dropdown menu by placing it within a `.btn-group` and providing the proper menu markup.
<h1 id="btn-dropdowns" class="page-header">Button dropdowns</h1>
<p class="lead">Use any button to trigger a dropdown menu by placing it within a <code>.btn-group</code> and providing the proper menu markup.</p> <div class="bs-callout bs-callout-danger">
<h4>Plugin dependency</h4>
<p>Button dropdowns require the <a href="../javascript/#dropdowns">dropdown plugin</a> to be included in your version of Bootstrap.</p>
</div>
<div class="bs-callout bs-callout-danger"> ### Single button dropdowns
<h4>Plugin dependency</h4>
<p>Button dropdowns require the <a href="../javascript/#dropdowns">dropdown plugin</a> to be included in your version of Bootstrap.</p> Turn a button into a dropdown toggle with some basic markup changes.
</div>
<div class="bs-example">
<div class="btn-group">
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown">Default</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div><!-- /btn-group -->
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">Primary</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div><!-- /btn-group -->
<div class="btn-group">
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown">Success</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div><!-- /btn-group -->
<div class="btn-group">
<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown">Info</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div><!-- /btn-group -->
<div class="btn-group">
<button type="button" class="btn btn-warning dropdown-toggle" data-toggle="dropdown">Warning</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div><!-- /btn-group -->
<div class="btn-group">
<button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown">Danger</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div><!-- /btn-group -->
</div>
<h3 id="btn-dropdowns-single">Single button dropdowns</h3>
<p>Turn a button into a dropdown toggle with some basic markup changes.</p>
<div class="bs-example">
<div class="btn-group">
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown">Default</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div><!-- /btn-group -->
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">Primary</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div><!-- /btn-group -->
<div class="btn-group">
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown">Success</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div><!-- /btn-group -->
<div class="btn-group">
<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown">Info</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div><!-- /btn-group -->
<div class="btn-group">
<button type="button" class="btn btn-warning dropdown-toggle" data-toggle="dropdown">Warning</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div><!-- /btn-group -->
<div class="btn-group">
<button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown">Danger</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div><!-- /btn-group -->
</div>
{% highlight html %} {% highlight html %}
<!-- Single button --> <!-- Single button -->
<div class="btn-group"> <div class="btn-group">
@ -93,88 +93,91 @@ title: Button dropdown
</div> </div>
{% endhighlight %} {% endhighlight %}
<h3 id="btn-dropdowns-split">Split button dropdowns</h3> ### Split button dropdowns
<p>Similarly, create split button dropdowns with the same markup changes, only with a separate button.</p>
<div class="bs-example"> <Similarly, create split button dropdowns with the same markup changes, only with a separate button.
<div class="btn-group">
<button type="button" class="btn btn-secondary">Default</button> <div class="bs-example">
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown"> <div class="btn-group">
<span class="sr-only">Toggle Dropdown</span> <button type="button" class="btn btn-secondary">Default</button>
</button> <button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown">
<ul class="dropdown-menu" role="menu"> <span class="sr-only">Toggle Dropdown</span>
<li><a href="#">Action</a></li> </button>
<li><a href="#">Another action</a></li> <ul class="dropdown-menu" role="menu">
<li><a href="#">Something else here</a></li> <li><a href="#">Action</a></li>
<li class="divider"></li> <li><a href="#">Another action</a></li>
<li><a href="#">Separated link</a></li> <li><a href="#">Something else here</a></li>
</ul> <li class="divider"></li>
</div><!-- /btn-group --> <li><a href="#">Separated link</a></li>
<div class="btn-group"> </ul>
<button type="button" class="btn btn-primary">Primary</button> </div><!-- /btn-group -->
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"> <div class="btn-group">
<span class="sr-only">Toggle Dropdown</span> <button type="button" class="btn btn-primary">Primary</button>
</button> <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<ul class="dropdown-menu" role="menu"> <span class="sr-only">Toggle Dropdown</span>
<li><a href="#">Action</a></li> </button>
<li><a href="#">Another action</a></li> <ul class="dropdown-menu" role="menu">
<li><a href="#">Something else here</a></li> <li><a href="#">Action</a></li>
<li class="divider"></li> <li><a href="#">Another action</a></li>
<li><a href="#">Separated link</a></li> <li><a href="#">Something else here</a></li>
</ul> <li class="divider"></li>
</div><!-- /btn-group --> <li><a href="#">Separated link</a></li>
<div class="btn-group"> </ul>
<button type="button" class="btn btn-success">Success</button> </div><!-- /btn-group -->
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown"> <div class="btn-group">
<span class="sr-only">Toggle Dropdown</span> <button type="button" class="btn btn-success">Success</button>
</button> <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown">
<ul class="dropdown-menu" role="menu"> <span class="sr-only">Toggle Dropdown</span>
<li><a href="#">Action</a></li> </button>
<li><a href="#">Another action</a></li> <ul class="dropdown-menu" role="menu">
<li><a href="#">Something else here</a></li> <li><a href="#">Action</a></li>
<li class="divider"></li> <li><a href="#">Another action</a></li>
<li><a href="#">Separated link</a></li> <li><a href="#">Something else here</a></li>
</ul> <li class="divider"></li>
</div><!-- /btn-group --> <li><a href="#">Separated link</a></li>
<div class="btn-group"> </ul>
<button type="button" class="btn btn-info">Info</button> </div><!-- /btn-group -->
<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown"> <div class="btn-group">
<span class="sr-only">Toggle Dropdown</span> <button type="button" class="btn btn-info">Info</button>
</button> <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown">
<ul class="dropdown-menu" role="menu"> <span class="sr-only">Toggle Dropdown</span>
<li><a href="#">Action</a></li> </button>
<li><a href="#">Another action</a></li> <ul class="dropdown-menu" role="menu">
<li><a href="#">Something else here</a></li> <li><a href="#">Action</a></li>
<li class="divider"></li> <li><a href="#">Another action</a></li>
<li><a href="#">Separated link</a></li> <li><a href="#">Something else here</a></li>
</ul> <li class="divider"></li>
</div><!-- /btn-group --> <li><a href="#">Separated link</a></li>
<div class="btn-group"> </ul>
<button type="button" class="btn btn-warning">Warning</button> </div><!-- /btn-group -->
<button type="button" class="btn btn-warning dropdown-toggle" data-toggle="dropdown"> <div class="btn-group">
<span class="sr-only">Toggle Dropdown</span> <button type="button" class="btn btn-warning">Warning</button>
</button> <button type="button" class="btn btn-warning dropdown-toggle" data-toggle="dropdown">
<ul class="dropdown-menu" role="menu"> <span class="sr-only">Toggle Dropdown</span>
<li><a href="#">Action</a></li> </button>
<li><a href="#">Another action</a></li> <ul class="dropdown-menu" role="menu">
<li><a href="#">Something else here</a></li> <li><a href="#">Action</a></li>
<li class="divider"></li> <li><a href="#">Another action</a></li>
<li><a href="#">Separated link</a></li> <li><a href="#">Something else here</a></li>
</ul> <li class="divider"></li>
</div><!-- /btn-group --> <li><a href="#">Separated link</a></li>
<div class="btn-group"> </ul>
<button type="button" class="btn btn-danger">Danger</button> </div><!-- /btn-group -->
<button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown"> <div class="btn-group">
<span class="sr-only">Toggle Dropdown</span> <button type="button" class="btn btn-danger">Danger</button>
</button> <button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown">
<ul class="dropdown-menu" role="menu"> <span class="sr-only">Toggle Dropdown</span>
<li><a href="#">Action</a></li> </button>
<li><a href="#">Another action</a></li> <ul class="dropdown-menu" role="menu">
<li><a href="#">Something else here</a></li> <li><a href="#">Action</a></li>
<li class="divider"></li> <li><a href="#">Another action</a></li>
<li><a href="#">Separated link</a></li> <li><a href="#">Something else here</a></li>
</ul> <li class="divider"></li>
</div><!-- /btn-group --> <li><a href="#">Separated link</a></li>
</div> </ul>
</div><!-- /btn-group -->
</div>
{% highlight html %} {% highlight html %}
<!-- Split button --> <!-- Split button -->
<div class="btn-group"> <div class="btn-group">
@ -192,52 +195,55 @@ title: Button dropdown
</div> </div>
{% endhighlight %} {% endhighlight %}
<h3 id="btn-dropdowns-sizing">Sizing</h3> ### Sizing
<p>Button dropdowns work with buttons of all sizes.</p>
<div class="bs-example"> Button dropdowns work with buttons of all sizes.
<div class="btn-toolbar" role="toolbar">
<div class="btn-group"> <div class="bs-example">
<button class="btn btn-secondary btn-lg dropdown-toggle" type="button" data-toggle="dropdown"> <div class="btn-toolbar" role="toolbar">
Large button <div class="btn-group">
</button> <button class="btn btn-secondary btn-lg dropdown-toggle" type="button" data-toggle="dropdown">
<ul class="dropdown-menu" role="menu"> Large button
<li><a href="#">Action</a></li> </button>
<li><a href="#">Another action</a></li> <ul class="dropdown-menu" role="menu">
<li><a href="#">Something else here</a></li> <li><a href="#">Action</a></li>
<li class="divider"></li> <li><a href="#">Another action</a></li>
<li><a href="#">Separated link</a></li> <li><a href="#">Something else here</a></li>
</ul> <li class="divider"></li>
</div><!-- /btn-group --> <li><a href="#">Separated link</a></li>
</div><!-- /btn-toolbar --> </ul>
<div class="btn-toolbar" role="toolbar"> </div><!-- /btn-group -->
<div class="btn-group"> </div><!-- /btn-toolbar -->
<button class="btn btn-secondary btn-sm dropdown-toggle" type="button" data-toggle="dropdown"> <div class="btn-toolbar" role="toolbar">
Small button <div class="btn-group">
</button> <button class="btn btn-secondary btn-sm dropdown-toggle" type="button" data-toggle="dropdown">
<ul class="dropdown-menu" role="menu"> Small button
<li><a href="#">Action</a></li> </button>
<li><a href="#">Another action</a></li> <ul class="dropdown-menu" role="menu">
<li><a href="#">Something else here</a></li> <li><a href="#">Action</a></li>
<li class="divider"></li> <li><a href="#">Another action</a></li>
<li><a href="#">Separated link</a></li> <li><a href="#">Something else here</a></li>
</ul> <li class="divider"></li>
</div><!-- /btn-group --> <li><a href="#">Separated link</a></li>
</div><!-- /btn-toolbar --> </ul>
<div class="btn-toolbar" role="toolbar"> </div><!-- /btn-group -->
<div class="btn-group"> </div><!-- /btn-toolbar -->
<button class="btn btn-secondary btn-xs dropdown-toggle" type="button" data-toggle="dropdown"> <div class="btn-toolbar" role="toolbar">
Extra small button <div class="btn-group">
</button> <button class="btn btn-secondary btn-xs dropdown-toggle" type="button" data-toggle="dropdown">
<ul class="dropdown-menu" role="menu"> Extra small button
<li><a href="#">Action</a></li> </button>
<li><a href="#">Another action</a></li> <ul class="dropdown-menu" role="menu">
<li><a href="#">Something else here</a></li> <li><a href="#">Action</a></li>
<li class="divider"></li> <li><a href="#">Another action</a></li>
<li><a href="#">Separated link</a></li> <li><a href="#">Something else here</a></li>
</ul> <li class="divider"></li>
</div><!-- /btn-group --> <li><a href="#">Separated link</a></li>
</div><!-- /btn-toolbar --> </ul>
</div><!-- /example --> </div><!-- /btn-group -->
</div><!-- /btn-toolbar -->
</div><!-- /example -->
{% highlight html %} {% highlight html %}
<!-- Large button group --> <!-- Large button group -->
<div class="btn-group"> <div class="btn-group">
@ -270,38 +276,41 @@ title: Button dropdown
</div> </div>
{% endhighlight %} {% endhighlight %}
<h3 id="btn-dropdowns-dropup">Dropup variation</h3> ### Dropup variation
<p>Trigger dropdown menus above elements by adding <code>.dropup</code> to the parent.</p>
<div class="bs-example"> Trigger dropdown menus above elements by adding `.dropup` to the parent.
<div class="btn-toolbar" role="toolbar">
<div class="btn-group dropup"> <div class="bs-example">
<button type="button" class="btn btn-secondary">Dropup</button> <div class="btn-toolbar" role="toolbar">
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown"> <div class="btn-group dropup">
<span class="sr-only">Toggle Dropdown</span> <button type="button" class="btn btn-secondary">Dropup</button>
</button> <button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown">
<ul class="dropdown-menu" role="menu"> <span class="sr-only">Toggle Dropdown</span>
<li><a href="#">Action</a></li> </button>
<li><a href="#">Another action</a></li> <ul class="dropdown-menu" role="menu">
<li><a href="#">Something else here</a></li> <li><a href="#">Action</a></li>
<li class="divider"></li> <li><a href="#">Another action</a></li>
<li><a href="#">Separated link</a></li> <li><a href="#">Something else here</a></li>
</ul> <li class="divider"></li>
</div><!-- /btn-group --> <li><a href="#">Separated link</a></li>
<div class="btn-group dropup"> </ul>
<button type="button" class="btn btn-primary">Right dropup</button> </div><!-- /btn-group -->
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"> <div class="btn-group dropup">
<span class="sr-only">Toggle Dropdown</span> <button type="button" class="btn btn-primary">Right dropup</button>
</button> <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<ul class="dropdown-menu dropdown-menu-right" role="menu"> <span class="sr-only">Toggle Dropdown</span>
<li><a href="#">Action</a></li> </button>
<li><a href="#">Another action</a></li> <ul class="dropdown-menu dropdown-menu-right" role="menu">
<li><a href="#">Something else here</a></li> <li><a href="#">Action</a></li>
<li class="divider"></li> <li><a href="#">Another action</a></li>
<li><a href="#">Separated link</a></li> <li><a href="#">Something else here</a></li>
</ul> <li class="divider"></li>
</div><!-- /btn-group --> <li><a href="#">Separated link</a></li>
</div> </ul>
</div><!-- /example --> </div><!-- /btn-group -->
</div>
</div>
{% highlight html %} {% highlight html %}
<div class="btn-group dropup"> <div class="btn-group dropup">
<button type="button" class="btn btn-secondary">Dropup</button> <button type="button" class="btn btn-secondary">Dropup</button>
@ -313,4 +322,3 @@ title: Button dropdown
</ul> </ul>
</div> </div>
{% endhighlight %} {% endhighlight %}
</div>