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
2020-06-16 22:55:34 +03:00
Dropdowns should be triggered by a `<button>` . ** [Each dropdown menu requires a directional class ](#alignment )**, much like our tooltips.
2018-12-05 03:21:27 +03:00
Using a GitHub button:
2019-07-30 02:56:17 +03:00
```html live
2019-09-06 00:31:03 +03:00
< div style = "margin-bottom: 100px" >
2019-09-06 00:09:38 +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 >
< / div >
2018-12-05 03:21:27 +03:00
```
Using a button customized with additional utilities:
2019-07-30 02:56:17 +03:00
```html live
2019-09-06 00:31:03 +03:00
< div style = "margin-bottom: 100px" >
2019-09-06 00:09:38 +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 >
< / div >
2018-12-05 03:21:27 +03:00
```
## Options
### Alignment
Align the direction of dropdown menus and their arrows with modifier classes.
2019-07-30 02:56:17 +03:00
```html live
2019-09-06 00:31:03 +03:00
< div style = "margin-top: 100px" >
< details class = "dropdown details-reset details-overlay d-inline-block" >
2019-09-06 00:09:38 +03:00
< 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 >
< / div >
2018-12-05 03:21:27 +03:00
```
2019-07-30 02:56:17 +03:00
```html live
2019-09-06 00:31:03 +03:00
< div style = "margin-bottom: 100px" >
2019-09-06 00:09:38 +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 >
< / div >
2018-12-05 03:21:27 +03:00
```
2019-07-30 02:56:17 +03:00
```html live
2019-09-06 00:31:03 +03:00
< div style = "margin-bottom: 100px" >
2019-09-06 00:09:38 +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 >
< / div >
2018-12-05 03:21:27 +03:00
```
2019-07-30 02:56:17 +03:00
```html live
2019-09-06 00:31:03 +03:00
< div style = "margin-bottom: 100px" class = "d-flex flex-justify-center" >
2019-09-06 00:09:38 +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 >
< / div >
2018-12-05 03:21:27 +03:00
```
2019-07-30 02:56:17 +03:00
```html live
2019-09-06 00:31:03 +03:00
< div style = "margin-bottom: 100px" class = "d-flex flex-justify-end" >
2019-09-06 00:09:38 +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 >
< / div >
2018-12-05 03:21:27 +03:00
```
2019-07-30 02:56:17 +03:00
```html live
2019-09-06 00:31:03 +03:00
< div style = "margin-bottom: 100px" class = "d-flex flex-justify-end" >
2019-09-06 00:09:38 +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 >
< / div >
2018-12-05 03:21:27 +03:00
```
### Dividers
2019-07-30 02:56:17 +03:00
```html live
2019-09-06 00:31:03 +03:00
< div style = "margin-bottom: 170px" >
2019-09-06 00:09:38 +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 >
< / div >
2018-12-05 03:21:27 +03:00
```
### Headers
2019-07-30 02:56:17 +03:00
```html live
2019-09-06 00:31:03 +03:00
< div style = "margin-bottom: 126px" >
2019-09-06 00:09:38 +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 >
2018-12-05 03:21:27 +03:00
< / div >
2019-09-06 00:09:38 +03:00
< / details >
< / div >
2018-12-05 03:21:27 +03:00
```