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