2014-07-13 09:59:31 +02:00
|
|
|
---
|
2015-08-15 07:45:55 +02:00
|
|
|
layout: docs
|
2014-07-13 09:59:31 +02:00
|
|
|
title: Button dropdown
|
2015-08-06 02:47:45 +02:00
|
|
|
group: components
|
2014-07-13 09:59:31 +02:00
|
|
|
---
|
|
|
|
|
2015-01-20 05:03:08 +01:00
|
|
|
Use any button to trigger a dropdown menu by placing it within a `.btn-group` and providing the proper dropdown menu markup.
|
2014-03-17 03:03:53 +01:00
|
|
|
|
2015-04-17 01:56:40 +02:00
|
|
|
{% callout danger %}
|
|
|
|
#### Plugin dependency
|
|
|
|
|
2015-08-21 02:15:17 +02:00
|
|
|
Button dropdowns require the [dropdown plugin]({{ site.baseurl }}/components/dropdowns/) to be included in your version of Bootstrap.
|
2015-04-17 01:56:40 +02:00
|
|
|
{% endcallout %}
|
2014-03-17 03:03:53 +01:00
|
|
|
|
2015-05-29 10:58:52 +02:00
|
|
|
## Contents
|
|
|
|
|
|
|
|
* Will be replaced with the ToC, excluding the "Contents" header
|
|
|
|
{:toc}
|
|
|
|
|
2014-07-13 10:23:29 +02:00
|
|
|
### Single button dropdowns
|
|
|
|
|
|
|
|
Turn a button into a dropdown toggle with some basic markup changes.
|
|
|
|
|
2015-04-16 23:07:20 +02:00
|
|
|
<div class="bd-example">
|
2014-07-13 10:23:29 +02:00
|
|
|
<div class="btn-group">
|
2015-06-19 08:56:43 +02:00
|
|
|
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Default</button>
|
2015-08-17 20:19:14 +02:00
|
|
|
<div class="dropdown-menu">
|
|
|
|
<a class="dropdown-item" href="#">Action</a>
|
|
|
|
<a class="dropdown-item" href="#">Another action</a>
|
|
|
|
<a class="dropdown-item" href="#">Something else here</a>
|
|
|
|
<div class="dropdown-divider"></div>
|
|
|
|
<a class="dropdown-item" href="#">Separated link</a>
|
|
|
|
</div>
|
2014-07-13 10:23:29 +02:00
|
|
|
</div><!-- /btn-group -->
|
|
|
|
<div class="btn-group">
|
2015-06-19 08:56:43 +02:00
|
|
|
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Primary</button>
|
2015-08-17 20:19:14 +02:00
|
|
|
<div class="dropdown-menu">
|
|
|
|
<a class="dropdown-item" href="#">Action</a>
|
|
|
|
<a class="dropdown-item" href="#">Another action</a>
|
|
|
|
<a class="dropdown-item" href="#">Something else here</a>
|
|
|
|
<div class="dropdown-divider"></div>
|
|
|
|
<a class="dropdown-item" href="#">Separated link</a>
|
|
|
|
</div>
|
2014-07-13 10:23:29 +02:00
|
|
|
</div><!-- /btn-group -->
|
|
|
|
<div class="btn-group">
|
2015-06-19 08:56:43 +02:00
|
|
|
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Success</button>
|
2015-08-17 20:19:14 +02:00
|
|
|
<div class="dropdown-menu">
|
|
|
|
<a class="dropdown-item" href="#">Action</a>
|
|
|
|
<a class="dropdown-item" href="#">Another action</a>
|
|
|
|
<a class="dropdown-item" href="#">Something else here</a>
|
|
|
|
<div class="dropdown-divider"></div>
|
|
|
|
<a class="dropdown-item" href="#">Separated link</a>
|
|
|
|
</div>
|
2014-07-13 10:23:29 +02:00
|
|
|
</div><!-- /btn-group -->
|
|
|
|
<div class="btn-group">
|
2015-06-19 08:56:43 +02:00
|
|
|
<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Info</button>
|
2015-08-17 20:19:14 +02:00
|
|
|
<div class="dropdown-menu">
|
|
|
|
<a class="dropdown-item" href="#">Action</a>
|
|
|
|
<a class="dropdown-item" href="#">Another action</a>
|
|
|
|
<a class="dropdown-item" href="#">Something else here</a>
|
|
|
|
<div class="dropdown-divider"></div>
|
|
|
|
<a class="dropdown-item" href="#">Separated link</a>
|
|
|
|
</div>
|
2014-07-13 10:23:29 +02:00
|
|
|
</div><!-- /btn-group -->
|
|
|
|
<div class="btn-group">
|
2015-06-19 08:56:43 +02:00
|
|
|
<button type="button" class="btn btn-warning dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Warning</button>
|
2015-08-17 20:19:14 +02:00
|
|
|
<div class="dropdown-menu">
|
|
|
|
<a class="dropdown-item" href="#">Action</a>
|
|
|
|
<a class="dropdown-item" href="#">Another action</a>
|
|
|
|
<a class="dropdown-item" href="#">Something else here</a>
|
|
|
|
<div class="dropdown-divider"></div>
|
|
|
|
<a class="dropdown-item" href="#">Separated link</a>
|
|
|
|
</div>
|
2014-07-13 10:23:29 +02:00
|
|
|
</div><!-- /btn-group -->
|
|
|
|
<div class="btn-group">
|
2015-06-19 08:56:43 +02:00
|
|
|
<button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Danger</button>
|
2015-08-17 20:19:14 +02:00
|
|
|
<div class="dropdown-menu">
|
|
|
|
<a class="dropdown-item" href="#">Action</a>
|
|
|
|
<a class="dropdown-item" href="#">Another action</a>
|
|
|
|
<a class="dropdown-item" href="#">Something else here</a>
|
|
|
|
<div class="dropdown-divider"></div>
|
|
|
|
<a class="dropdown-item" href="#">Separated link</a>
|
|
|
|
</div>
|
2014-07-13 10:23:29 +02:00
|
|
|
</div><!-- /btn-group -->
|
|
|
|
</div>
|
2014-03-17 03:03:53 +01:00
|
|
|
|
|
|
|
{% highlight html %}
|
|
|
|
<!-- Single button -->
|
|
|
|
<div class="btn-group">
|
2015-06-19 08:56:43 +02:00
|
|
|
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
2014-07-08 23:23:34 +02:00
|
|
|
Action
|
2014-03-17 03:03:53 +01:00
|
|
|
</button>
|
2015-08-17 20:19:14 +02:00
|
|
|
<div class="dropdown-menu">
|
|
|
|
<a class="dropdown-item" href="#">Action</a>
|
|
|
|
<a class="dropdown-item" href="#">Another action</a>
|
|
|
|
<a class="dropdown-item" href="#">Something else here</a>
|
|
|
|
<div class="dropdown-divider"></div>
|
|
|
|
<a class="dropdown-item" href="#">Separated link</a>
|
|
|
|
</div>
|
2014-03-17 03:03:53 +01:00
|
|
|
</div>
|
|
|
|
{% endhighlight %}
|
|
|
|
|
2014-07-13 10:23:29 +02:00
|
|
|
### Split button dropdowns
|
|
|
|
|
2015-03-09 15:50:40 +01:00
|
|
|
Similarly, create split button dropdowns with the same markup changes, only with a separate button.
|
2014-07-13 10:23:29 +02:00
|
|
|
|
2015-04-16 23:07:20 +02:00
|
|
|
<div class="bd-example">
|
2014-07-13 10:23:29 +02:00
|
|
|
<div class="btn-group">
|
|
|
|
<button type="button" class="btn btn-secondary">Default</button>
|
2015-06-19 08:56:43 +02:00
|
|
|
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
2014-07-13 10:23:29 +02:00
|
|
|
<span class="sr-only">Toggle Dropdown</span>
|
|
|
|
</button>
|
2015-08-17 20:19:14 +02:00
|
|
|
<div class="dropdown-menu">
|
|
|
|
<a class="dropdown-item" href="#">Action</a>
|
|
|
|
<a class="dropdown-item" href="#">Another action</a>
|
|
|
|
<a class="dropdown-item" href="#">Something else here</a>
|
|
|
|
<div class="dropdown-divider"></div>
|
|
|
|
<a class="dropdown-item" href="#">Separated link</a>
|
|
|
|
</div>
|
2014-07-13 10:23:29 +02:00
|
|
|
</div><!-- /btn-group -->
|
|
|
|
<div class="btn-group">
|
|
|
|
<button type="button" class="btn btn-primary">Primary</button>
|
2015-06-19 08:56:43 +02:00
|
|
|
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
2014-07-13 10:23:29 +02:00
|
|
|
<span class="sr-only">Toggle Dropdown</span>
|
|
|
|
</button>
|
2015-08-17 20:19:14 +02:00
|
|
|
<div class="dropdown-menu">
|
|
|
|
<a class="dropdown-item" href="#">Action</a>
|
|
|
|
<a class="dropdown-item" href="#">Another action</a>
|
|
|
|
<a class="dropdown-item" href="#">Something else here</a>
|
|
|
|
<div class="dropdown-divider"></div>
|
|
|
|
<a class="dropdown-item" href="#">Separated link</a>
|
|
|
|
</div>
|
2014-07-13 10:23:29 +02:00
|
|
|
</div><!-- /btn-group -->
|
|
|
|
<div class="btn-group">
|
|
|
|
<button type="button" class="btn btn-success">Success</button>
|
2015-06-19 08:56:43 +02:00
|
|
|
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
2014-07-13 10:23:29 +02:00
|
|
|
<span class="sr-only">Toggle Dropdown</span>
|
|
|
|
</button>
|
2015-08-17 20:19:14 +02:00
|
|
|
<div class="dropdown-menu">
|
|
|
|
<a class="dropdown-item" href="#">Action</a>
|
|
|
|
<a class="dropdown-item" href="#">Another action</a>
|
|
|
|
<a class="dropdown-item" href="#">Something else here</a>
|
|
|
|
<div class="dropdown-divider"></div>
|
|
|
|
<a class="dropdown-item" href="#">Separated link</a>
|
|
|
|
</div>
|
2014-07-13 10:23:29 +02:00
|
|
|
</div><!-- /btn-group -->
|
|
|
|
<div class="btn-group">
|
|
|
|
<button type="button" class="btn btn-info">Info</button>
|
2015-06-19 08:56:43 +02:00
|
|
|
<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
2014-07-13 10:23:29 +02:00
|
|
|
<span class="sr-only">Toggle Dropdown</span>
|
|
|
|
</button>
|
2015-08-17 20:19:14 +02:00
|
|
|
<div class="dropdown-menu">
|
|
|
|
<a class="dropdown-item" href="#">Action</a>
|
|
|
|
<a class="dropdown-item" href="#">Another action</a>
|
|
|
|
<a class="dropdown-item" href="#">Something else here</a>
|
|
|
|
<div class="dropdown-divider"></div>
|
|
|
|
<a class="dropdown-item" href="#">Separated link</a>
|
|
|
|
</div>
|
2014-07-13 10:23:29 +02:00
|
|
|
</div><!-- /btn-group -->
|
|
|
|
<div class="btn-group">
|
|
|
|
<button type="button" class="btn btn-warning">Warning</button>
|
2015-06-19 08:56:43 +02:00
|
|
|
<button type="button" class="btn btn-warning dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
2014-07-13 10:23:29 +02:00
|
|
|
<span class="sr-only">Toggle Dropdown</span>
|
|
|
|
</button>
|
2015-08-17 20:19:14 +02:00
|
|
|
<div class="dropdown-menu">
|
|
|
|
<a class="dropdown-item" href="#">Action</a>
|
|
|
|
<a class="dropdown-item" href="#">Another action</a>
|
|
|
|
<a class="dropdown-item" href="#">Something else here</a>
|
|
|
|
<div class="dropdown-divider"></div>
|
|
|
|
<a class="dropdown-item" href="#">Separated link</a>
|
|
|
|
</div>
|
2014-07-13 10:23:29 +02:00
|
|
|
</div><!-- /btn-group -->
|
|
|
|
<div class="btn-group">
|
|
|
|
<button type="button" class="btn btn-danger">Danger</button>
|
2015-06-19 08:56:43 +02:00
|
|
|
<button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
2014-07-13 10:23:29 +02:00
|
|
|
<span class="sr-only">Toggle Dropdown</span>
|
|
|
|
</button>
|
2015-08-17 20:19:14 +02:00
|
|
|
<div class="dropdown-menu">
|
|
|
|
<a class="dropdown-item" href="#">Action</a>
|
|
|
|
<a class="dropdown-item" href="#">Another action</a>
|
|
|
|
<a class="dropdown-item" href="#">Something else here</a>
|
|
|
|
<div class="dropdown-divider"></div>
|
|
|
|
<a class="dropdown-item" href="#">Separated link</a>
|
|
|
|
</div>
|
2014-07-13 10:23:29 +02:00
|
|
|
</div><!-- /btn-group -->
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{% highlight html %}
|
|
|
|
<!-- Split button -->
|
|
|
|
<div class="btn-group">
|
|
|
|
<button type="button" class="btn btn-danger">Action</button>
|
2015-06-19 08:56:43 +02:00
|
|
|
<button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
2014-07-13 10:23:29 +02:00
|
|
|
<span class="sr-only">Toggle Dropdown</span>
|
|
|
|
</button>
|
2015-08-17 20:19:14 +02:00
|
|
|
<div class="dropdown-menu">
|
|
|
|
<a class="dropdown-item" href="#">Action</a>
|
|
|
|
<a class="dropdown-item" href="#">Another action</a>
|
|
|
|
<a class="dropdown-item" href="#">Something else here</a>
|
|
|
|
<div class="dropdown-divider"></div>
|
|
|
|
<a class="dropdown-item" href="#">Separated link</a>
|
|
|
|
</div>
|
2014-07-13 10:23:29 +02:00
|
|
|
</div>
|
|
|
|
{% endhighlight %}
|
|
|
|
|
|
|
|
### Sizing
|
|
|
|
|
|
|
|
Button dropdowns work with buttons of all sizes.
|
|
|
|
|
2015-04-16 23:07:20 +02:00
|
|
|
<div class="bd-example">
|
2014-07-13 10:23:29 +02:00
|
|
|
<div class="btn-toolbar" role="toolbar">
|
2014-03-17 03:03:53 +01:00
|
|
|
<div class="btn-group">
|
2015-06-19 08:56:43 +02:00
|
|
|
<button class="btn btn-secondary btn-lg dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
2014-07-13 10:23:29 +02:00
|
|
|
Large button
|
2014-03-17 03:03:53 +01:00
|
|
|
</button>
|
2015-08-17 20:19:14 +02:00
|
|
|
<div class="dropdown-menu">
|
|
|
|
<a class="dropdown-item" href="#">Action</a>
|
|
|
|
<a class="dropdown-item" href="#">Another action</a>
|
|
|
|
<a class="dropdown-item" href="#">Something else here</a>
|
|
|
|
<div class="dropdown-divider"></div>
|
|
|
|
<a class="dropdown-item" href="#">Separated link</a>
|
|
|
|
</div>
|
2014-03-17 03:03:53 +01:00
|
|
|
</div><!-- /btn-group -->
|
2014-07-13 10:23:29 +02:00
|
|
|
</div><!-- /btn-toolbar -->
|
|
|
|
<div class="btn-toolbar" role="toolbar">
|
2014-03-17 03:03:53 +01:00
|
|
|
<div class="btn-group">
|
2015-06-19 08:56:43 +02:00
|
|
|
<button class="btn btn-secondary btn-sm dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
2014-07-13 10:23:29 +02:00
|
|
|
Small button
|
2014-03-17 03:03:53 +01:00
|
|
|
</button>
|
2015-08-17 20:19:14 +02:00
|
|
|
<div class="dropdown-menu">
|
|
|
|
<a class="dropdown-item" href="#">Action</a>
|
|
|
|
<a class="dropdown-item" href="#">Another action</a>
|
|
|
|
<a class="dropdown-item" href="#">Something else here</a>
|
|
|
|
<div class="dropdown-divider"></div>
|
|
|
|
<a class="dropdown-item" href="#">Separated link</a>
|
|
|
|
</div>
|
2014-03-17 03:03:53 +01:00
|
|
|
</div><!-- /btn-group -->
|
2014-07-13 10:23:29 +02:00
|
|
|
</div><!-- /btn-toolbar -->
|
|
|
|
</div><!-- /example -->
|
2014-03-17 03:03:53 +01:00
|
|
|
|
|
|
|
{% highlight html %}
|
|
|
|
<!-- Large button group -->
|
|
|
|
<div class="btn-group">
|
2015-06-19 08:56:43 +02:00
|
|
|
<button class="btn btn-secondary btn-lg dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
2014-07-08 23:23:34 +02:00
|
|
|
Large button
|
2014-03-17 03:03:53 +01:00
|
|
|
</button>
|
2015-08-17 20:19:14 +02:00
|
|
|
<div class="dropdown-menu">
|
2014-03-17 03:03:53 +01:00
|
|
|
...
|
2015-08-17 20:19:14 +02:00
|
|
|
</div>
|
2014-03-17 03:03:53 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Small button group -->
|
|
|
|
<div class="btn-group">
|
2015-06-19 08:56:43 +02:00
|
|
|
<button class="btn btn-secondary btn-sm dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
2014-07-08 23:23:34 +02:00
|
|
|
Small button
|
2014-03-17 03:03:53 +01:00
|
|
|
</button>
|
2015-08-17 20:19:14 +02:00
|
|
|
<div class="dropdown-menu">
|
2014-03-17 03:03:53 +01:00
|
|
|
...
|
2015-08-17 20:19:14 +02:00
|
|
|
</div>
|
2014-03-17 03:03:53 +01:00
|
|
|
</div>
|
|
|
|
{% endhighlight %}
|
|
|
|
|
2014-07-13 10:23:29 +02:00
|
|
|
### Dropup variation
|
|
|
|
|
|
|
|
Trigger dropdown menus above elements by adding `.dropup` to the parent.
|
|
|
|
|
2015-04-16 23:07:20 +02:00
|
|
|
<div class="bd-example">
|
2014-07-13 10:23:29 +02:00
|
|
|
<div class="btn-toolbar" role="toolbar">
|
|
|
|
<div class="btn-group dropup">
|
|
|
|
<button type="button" class="btn btn-secondary">Dropup</button>
|
2015-06-19 08:56:43 +02:00
|
|
|
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
2014-07-13 10:23:29 +02:00
|
|
|
<span class="sr-only">Toggle Dropdown</span>
|
|
|
|
</button>
|
2015-08-17 20:19:14 +02:00
|
|
|
<div class="dropdown-menu">
|
|
|
|
<a class="dropdown-item" href="#">Action</a>
|
|
|
|
<a class="dropdown-item" href="#">Another action</a>
|
|
|
|
<a class="dropdown-item" href="#">Something else here</a>
|
|
|
|
<div class="dropdown-divider"></div>
|
|
|
|
<a class="dropdown-item" href="#">Separated link</a>
|
|
|
|
</div>
|
2014-07-13 10:23:29 +02:00
|
|
|
</div><!-- /btn-group -->
|
|
|
|
<div class="btn-group dropup">
|
|
|
|
<button type="button" class="btn btn-primary">Right dropup</button>
|
2015-06-19 08:56:43 +02:00
|
|
|
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
2014-07-13 10:23:29 +02:00
|
|
|
<span class="sr-only">Toggle Dropdown</span>
|
|
|
|
</button>
|
2015-08-17 20:19:14 +02:00
|
|
|
<div class="dropdown-menu dropdown-menu-right">
|
|
|
|
<a class="dropdown-item" href="#">Action</a>
|
|
|
|
<a class="dropdown-item" href="#">Another action</a>
|
|
|
|
<a class="dropdown-item" href="#">Something else here</a>
|
|
|
|
<div class="dropdown-divider"></div>
|
|
|
|
<a class="dropdown-item" href="#">Separated link</a>
|
|
|
|
</div>
|
2014-07-13 10:23:29 +02:00
|
|
|
</div><!-- /btn-group -->
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2014-03-17 03:03:53 +01:00
|
|
|
{% highlight html %}
|
|
|
|
<div class="btn-group dropup">
|
2014-07-09 02:14:14 +02:00
|
|
|
<button type="button" class="btn btn-secondary">Dropup</button>
|
2015-06-19 08:56:43 +02:00
|
|
|
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
2014-03-17 03:03:53 +01:00
|
|
|
<span class="sr-only">Toggle Dropdown</span>
|
|
|
|
</button>
|
2015-08-17 20:19:14 +02:00
|
|
|
<div class="dropdown-menu">
|
2014-03-17 03:03:53 +01:00
|
|
|
<!-- Dropdown menu links -->
|
2015-08-17 20:19:14 +02:00
|
|
|
</div>
|
2014-03-17 03:03:53 +01:00
|
|
|
</div>
|
|
|
|
{% endhighlight %}
|