2014-07-13 15:59:31 +08:00
---
2015-08-15 13:45:55 +08:00
layout: docs
2014-07-13 15:59:31 +08:00
title: Button dropdown
2015-08-06 08:47:45 +08:00
group: components
2014-07-13 15:59:31 +08:00
---
2015-01-20 12:03:08 +08: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 10:03:53 +08:00
2015-04-17 07:56:40 +08:00
{% callout danger %}
#### Plugin dependency
2015-08-21 08:15:17 +08:00
Button dropdowns require the [dropdown plugin ]({{ site.baseurl }}/components/dropdowns/ ) to be included in your version of Bootstrap.
2015-04-17 07:56:40 +08:00
{% endcallout %}
2014-03-17 10:03:53 +08:00
2015-05-29 16:58:52 +08:00
## Contents
* Will be replaced with the ToC, excluding the "Contents" header
{:toc}
2016-05-12 02:36:09 +08:00
## Single button dropdowns
2014-07-13 16:23:29 +08:00
2016-05-12 02:36:09 +08:00
Turn a button into a dropdown toggle with some basic markup changes for the menu itself and the button used to trigger it.
2014-07-13 16:23:29 +08:00
2015-04-17 05:07:20 +08:00
< div class = "bd-example" >
2014-07-13 16:23:29 +08:00
< div class = "btn-group" >
2015-06-19 14:56:43 +08:00
< button type = "button" class = "btn btn-secondary dropdown-toggle" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" > Default< / button >
2015-08-18 02:19:14 +08: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 16:23:29 +08:00
< / div > <!-- /btn - group -->
< div class = "btn-group" >
2015-06-19 14:56:43 +08:00
< button type = "button" class = "btn btn-primary dropdown-toggle" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" > Primary< / button >
2015-08-18 02:19:14 +08: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 16:23:29 +08:00
< / div > <!-- /btn - group -->
< div class = "btn-group" >
2015-06-19 14:56:43 +08:00
< button type = "button" class = "btn btn-success dropdown-toggle" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" > Success< / button >
2015-08-18 02:19:14 +08: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 16:23:29 +08:00
< / div > <!-- /btn - group -->
< div class = "btn-group" >
2015-06-19 14:56:43 +08:00
< button type = "button" class = "btn btn-info dropdown-toggle" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" > Info< / button >
2015-08-18 02:19:14 +08: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 16:23:29 +08:00
< / div > <!-- /btn - group -->
< div class = "btn-group" >
2015-06-19 14:56:43 +08:00
< button type = "button" class = "btn btn-warning dropdown-toggle" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" > Warning< / button >
2015-08-18 02:19:14 +08: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 16:23:29 +08:00
< / div > <!-- /btn - group -->
< div class = "btn-group" >
2015-06-19 14:56:43 +08:00
< button type = "button" class = "btn btn-danger dropdown-toggle" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" > Danger< / button >
2015-08-18 02:19:14 +08: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 16:23:29 +08:00
< / div > <!-- /btn - group -->
< / div >
2014-03-17 10:03:53 +08:00
{% highlight html %}
<!-- Single button -->
< div class = "btn-group" >
2015-06-19 14:56:43 +08:00
< button type = "button" class = "btn btn-secondary dropdown-toggle" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" >
2014-07-09 05:23:34 +08:00
Action
2014-03-17 10:03:53 +08:00
< / button >
2015-08-18 02:19:14 +08: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 10:03:53 +08:00
< / div >
{% endhighlight %}
2016-05-12 02:36:09 +08:00
## Split button dropdowns
2014-07-13 16:23:29 +08:00
2016-05-12 02:36:09 +08:00
Similarly, create split button dropdowns with virtually the same markup as single button dropdowns, but with the addition of `.dropdown-toggle-split` for proper spacing around the dropdown caret.
We use this extra class to reduce the horizontal `padding` on either side of the caret by 25% and remove the `margin-left` that's added for regular button dropdowns. Those extra changes keep the caret centered in the split button and provide a more appropriately sized hit area next to the main button.
2014-07-13 16:23:29 +08:00
2015-04-17 05:07:20 +08:00
< div class = "bd-example" >
2014-07-13 16:23:29 +08:00
< div class = "btn-group" >
< button type = "button" class = "btn btn-secondary" > Default< / button >
2016-01-09 05:23:24 +08: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 16:23:29 +08:00
< span class = "sr-only" > Toggle Dropdown< / span >
< / button >
2015-08-18 02:19:14 +08: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 16:23:29 +08:00
< / div > <!-- /btn - group -->
< div class = "btn-group" >
< button type = "button" class = "btn btn-primary" > Primary< / button >
2016-01-09 05:23:24 +08: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 16:23:29 +08:00
< span class = "sr-only" > Toggle Dropdown< / span >
< / button >
2015-08-18 02:19:14 +08: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 16:23:29 +08:00
< / div > <!-- /btn - group -->
< div class = "btn-group" >
< button type = "button" class = "btn btn-success" > Success< / button >
2016-01-09 05:23:24 +08: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 16:23:29 +08:00
< span class = "sr-only" > Toggle Dropdown< / span >
< / button >
2015-08-18 02:19:14 +08: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 16:23:29 +08:00
< / div > <!-- /btn - group -->
< div class = "btn-group" >
< button type = "button" class = "btn btn-info" > Info< / button >
2016-01-09 05:23:24 +08: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 16:23:29 +08:00
< span class = "sr-only" > Toggle Dropdown< / span >
< / button >
2015-08-18 02:19:14 +08: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 16:23:29 +08:00
< / div > <!-- /btn - group -->
< div class = "btn-group" >
< button type = "button" class = "btn btn-warning" > Warning< / button >
2016-01-09 05:23:24 +08: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 16:23:29 +08:00
< span class = "sr-only" > Toggle Dropdown< / span >
< / button >
2015-08-18 02:19:14 +08: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 16:23:29 +08:00
< / div > <!-- /btn - group -->
< div class = "btn-group" >
< button type = "button" class = "btn btn-danger" > Danger< / button >
2016-01-09 05:23:24 +08: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 16:23:29 +08:00
< span class = "sr-only" > Toggle Dropdown< / span >
< / button >
2015-08-18 02:19:14 +08: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 16:23:29 +08:00
< / div > <!-- /btn - group -->
< / div >
{% highlight html %}
2016-01-09 05:23:24 +08:00
<!-- Example split button -->
2014-07-13 16:23:29 +08:00
< div class = "btn-group" >
< button type = "button" class = "btn btn-danger" > Action< / button >
2016-01-09 05:23:24 +08: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 16:23:29 +08:00
< span class = "sr-only" > Toggle Dropdown< / span >
< / button >
2015-08-18 02:19:14 +08: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 16:23:29 +08:00
< / div >
{% endhighlight %}
2016-05-12 02:36:09 +08:00
## Sizing
2014-07-13 16:23:29 +08:00
2016-05-12 02:36:09 +08:00
Button dropdowns work with buttons of all sizes, including default and split dropdown buttons.
2014-07-13 16:23:29 +08:00
2015-04-17 05:07:20 +08:00
< div class = "bd-example" >
2014-07-13 16:23:29 +08:00
< div class = "btn-toolbar" role = "toolbar" >
2014-03-17 10:03:53 +08:00
< div class = "btn-group" >
2015-06-19 14:56:43 +08:00
< button class = "btn btn-secondary btn-lg dropdown-toggle" type = "button" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" >
2014-07-13 16:23:29 +08:00
Large button
2014-03-17 10:03:53 +08:00
< / button >
2015-08-18 02:19:14 +08: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 10:03:53 +08:00
< / div > <!-- /btn - group -->
2016-01-09 05:23:24 +08: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 16:23:29 +08:00
< / div > <!-- /btn - toolbar -->
< div class = "btn-toolbar" role = "toolbar" >
2014-03-17 10:03:53 +08:00
< div class = "btn-group" >
2015-06-19 14:56:43 +08:00
< button class = "btn btn-secondary btn-sm dropdown-toggle" type = "button" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" >
2014-07-13 16:23:29 +08:00
Small button
2014-03-17 10:03:53 +08:00
< / button >
2015-08-18 02:19:14 +08: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 10:03:53 +08:00
< / div > <!-- /btn - group -->
2016-01-09 05:23:24 +08: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 16:23:29 +08:00
< / div > <!-- /btn - toolbar -->
< / div > <!-- /example -->
2014-03-17 10:03:53 +08:00
{% highlight html %}
2016-05-12 02:36:09 +08:00
<!-- Large button groups (default and split) -->
< div class = "btn-group" >
< button class = "btn btn-secondary btn-lg dropdown-toggle" type = "button" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" >
Large button
< / button >
< div class = "dropdown-menu" >
...
< / div >
< / div >
2014-03-17 10:03:53 +08:00
< div class = "btn-group" >
2015-06-19 14:56:43 +08:00
< button class = "btn btn-secondary btn-lg dropdown-toggle" type = "button" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" >
2014-07-09 05:23:34 +08:00
Large button
2014-03-17 10:03:53 +08:00
< / button >
2016-05-12 02:36:09 +08:00
< 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 >
2015-08-18 02:19:14 +08:00
< div class = "dropdown-menu" >
2014-03-17 10:03:53 +08:00
...
2015-08-18 02:19:14 +08:00
< / div >
2014-03-17 10:03:53 +08:00
< / div >
2016-05-12 02:36:09 +08:00
<!-- Small button groups (default and split) -->
< div class = "btn-group" >
< button class = "btn btn-secondary btn-sm dropdown-toggle" type = "button" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" >
Small button
< / button >
< div class = "dropdown-menu" >
...
< / div >
< / div >
2014-03-17 10:03:53 +08:00
< div class = "btn-group" >
2015-06-19 14:56:43 +08:00
< button class = "btn btn-secondary btn-sm dropdown-toggle" type = "button" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" >
2014-07-09 05:23:34 +08:00
Small button
2014-03-17 10:03:53 +08:00
< / button >
2016-05-12 02:36:09 +08:00
< 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 >
2015-08-18 02:19:14 +08:00
< div class = "dropdown-menu" >
2014-03-17 10:03:53 +08:00
...
2015-08-18 02:19:14 +08:00
< / div >
2014-03-17 10:03:53 +08:00
< / div >
{% endhighlight %}
2016-05-12 02:36:09 +08:00
## Dropup variation
2014-07-13 16:23:29 +08:00
Trigger dropdown menus above elements by adding `.dropup` to the parent.
2015-04-17 05:07:20 +08:00
< div class = "bd-example" >
2014-07-13 16:23:29 +08:00
< div class = "btn-toolbar" role = "toolbar" >
< div class = "btn-group dropup" >
2015-06-19 14:56:43 +08:00
< button type = "button" class = "btn btn-secondary dropdown-toggle" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" >
2016-05-12 02:36:09 +08:00
Dropup
2014-07-13 16:23:29 +08:00
< / button >
2015-08-18 02:19:14 +08: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 >
2016-05-12 02:36:09 +08:00
< / div >
2014-07-13 16:23:29 +08:00
< div class = "btn-group dropup" >
2016-05-12 02:36:09 +08:00
< button type = "button" class = "btn btn-secondary" >
Split dropup
< / button >
< button type = "button" class = "btn btn-secondary dropdown-toggle" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" >
2014-07-13 16:23:29 +08:00
< span class = "sr-only" > Toggle Dropdown< / span >
< / button >
2016-05-12 02:36:09 +08:00
< div class = "dropdown-menu" >
2015-08-18 02:19:14 +08:00
< 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 >
2016-05-12 02:36:09 +08:00
< / div >
2014-07-13 16:23:29 +08:00
< / div >
< / div >
2014-03-17 10:03:53 +08:00
{% highlight html %}
2016-05-12 02:36:09 +08:00
<!-- Default dropup button -->
2014-03-17 10:03:53 +08:00
< div class = "btn-group dropup" >
2014-07-09 08:14:14 +08:00
< button type = "button" class = "btn btn-secondary" > Dropup< / button >
2015-06-19 14:56:43 +08:00
< button type = "button" class = "btn btn-secondary dropdown-toggle" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" >
2014-03-17 10:03:53 +08:00
< span class = "sr-only" > Toggle Dropdown< / span >
< / button >
2015-08-18 02:19:14 +08:00
< div class = "dropdown-menu" >
2014-03-17 10:03:53 +08:00
<!-- Dropdown menu links -->
2015-08-18 02:19:14 +08:00
< / div >
2014-03-17 10:03:53 +08:00
< / div >
2016-05-12 02:36:09 +08:00
<!-- 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" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" >
< span class = "sr-only" > Toggle Dropdown< / span >
< / button >
< div class = "dropdown-menu" >
<!-- Dropdown menu links -->
< / div >
< / div >
2014-03-17 10:03:53 +08:00
{% endhighlight %}