2018-12-05 03:21:27 +03:00
---
title: Dropdown
2019-09-05 23:40:02 +03:00
status: New
2018-12-05 03:21:27 +03:00
---
2019-08-21 09:51:37 +03:00
Dropdowns are lightweight context menus for housing navigation and actions. They're great for instances where you don't need the full power (and code) of the select menu.
2018-12-05 03:21:27 +03:00
## Basic examples
Dropdowns should be trigged by a `<button>` . ** [Each dropdown menu requires a directional class ](#alignment )**, much like our tooltips.
Using a GitHub button:
2019-07-30 02:56:17 +03:00
```html live
2018-12-05 03:21:27 +03:00
< details class = "dropdown details-reset details-overlay d-inline-block" >
< summary class = "btn" aria-haspopup = "true" >
Dropdown
< div class = "dropdown-caret" > < / div >
< / summary >
< ul class = "dropdown-menu dropdown-menu-se" >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< / ul >
< / details >
```
Using a button customized with additional utilities:
2019-07-30 02:56:17 +03:00
```html live
2018-12-05 03:21:27 +03:00
< details class = "dropdown details-reset details-overlay d-inline-block" >
< summary class = "text-gray p-2 d-inline" aria-haspopup = "true" >
Dropdown
< div class = "dropdown-caret" > < / div >
< / summary >
< ul class = "dropdown-menu dropdown-menu-se" >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< / ul >
< / details >
```
## Options
### Alignment
Align the direction of dropdown menus and their arrows with modifier classes.
2019-07-30 02:56:17 +03:00
```html live
2018-12-05 03:21:27 +03:00
< details class = "dropdown details-reset details-overlay d-inline-block" >
< summary class = "btn" aria-haspopup = "true" >
.dropdown-ne
< div class = "dropdown-caret" > < / div >
< / summary >
< ul class = "dropdown-menu dropdown-menu-ne" >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< / ul >
< / details >
```
2019-07-30 02:56:17 +03:00
```html live
2018-12-05 03:21:27 +03:00
< details class = "dropdown details-reset details-overlay d-inline-block" >
< summary class = "btn" aria-haspopup = "true" >
.dropdown-e
< div class = "dropdown-caret" > < / div >
< / summary >
< ul class = "dropdown-menu dropdown-menu-e" >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< / ul >
< / details >
```
2019-07-30 02:56:17 +03:00
```html live
2018-12-05 03:21:27 +03:00
< details class = "dropdown details-reset details-overlay d-inline-block" >
< summary class = "btn" aria-haspopup = "true" >
.dropdown-se
< div class = "dropdown-caret" > < / div >
< / summary >
< ul class = "dropdown-menu dropdown-menu-se" >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< / ul >
< / details >
```
2019-07-30 02:56:17 +03:00
```html live
2018-12-05 03:21:27 +03:00
< details class = "dropdown details-reset details-overlay d-inline-block" >
< summary class = "btn" aria-haspopup = "true" >
.dropdown-s
< div class = "dropdown-caret" > < / div >
< / summary >
< ul class = "dropdown-menu dropdown-menu-s" >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< / ul >
< / details >
```
2019-07-30 02:56:17 +03:00
```html live
2018-12-05 03:21:27 +03:00
< details class = "dropdown details-reset details-overlay d-inline-block" >
< summary class = "btn" aria-haspopup = "true" >
.dropdown-sw
< div class = "dropdown-caret" > < / div >
< / summary >
< ul class = "dropdown-menu dropdown-menu-sw" >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< / ul >
< / details >
```
2019-07-30 02:56:17 +03:00
```html live
2018-12-05 03:21:27 +03:00
< details class = "dropdown details-reset details-overlay d-inline-block" >
< summary class = "btn" aria-haspopup = "true" >
.dropdown-w
< div class = "dropdown-caret" > < / div >
< / summary >
< ul class = "dropdown-menu dropdown-menu-w" >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< / ul >
< / details >
```
### Dividers
2019-07-30 02:56:17 +03:00
```html live
2018-12-05 03:21:27 +03:00
< details class = "dropdown details-reset details-overlay d-inline-block" >
< summary class = "btn" aria-haspopup = "true" >
Dropdown
< div class = "dropdown-caret" > < / div >
< / summary >
< ul class = "dropdown-menu dropdown-menu-se" >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li class = "dropdown-divider" role = "separator" > < / li >
< li > < a class = "dropdown-item" href = "#url" > Another item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > One more< / a > < / li >
< / ul >
< / details >
```
### Headers
2019-07-30 02:56:17 +03:00
```html live
2018-12-05 03:21:27 +03:00
< details class = "dropdown details-reset details-overlay d-inline-block" >
< summary class = "btn" aria-haspopup = "true" >
Dropdown
< div class = "dropdown-caret" > < / div >
< / summary >
< div class = "dropdown-menu dropdown-menu-se" >
< div class = "dropdown-header" >
Dropdown header
< / div >
< ul >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< / ul >
< / div >
< / details >
```
2019-07-31 00:50:23 +03:00
### Dark
2019-08-21 09:19:43 +03:00
```html live
< div class = "bg-gray-dark p-3 mt-n3 ml-n3 mr-n3" style = "min-height: 240px;" >
2019-07-31 00:50:23 +03:00
< details class = "dropdown details-reset details-overlay d-inline-block" >
< summary class = "btn" aria-haspopup = "true" >
Dropdown
< div class = "dropdown-caret" > < / div >
< / summary >
< div class = "dropdown-menu dropdown-menu-se dropdown-menu-dark" >
< div class = "dropdown-header" >
Dropdown header
< / div >
< ul >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
2019-09-03 23:03:24 +03:00
< li class = "dropdown-divider" role = "none" > < / li >
2019-07-31 00:50:23 +03:00
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< li > < a class = "dropdown-item" href = "#url" > Dropdown item< / a > < / li >
< / ul >
< / div >
< / details >
< / div >
2019-08-21 09:19:43 +03:00
```