diff options
| author | ysds <[email protected]> | 2018-10-21 17:01:22 +0900 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2018-10-21 11:01:22 +0300 |
| commit | becb6ce346a69fccccb1828e289ae4e4d3af8535 (patch) | |
| tree | 71690ab7fa90b33626393e06c3e4cae5727ee7ce /site/docs | |
| parent | 6bae9ef7866e0bf037229bb369e07d6aeabd934c (diff) | |
| download | bootstrap-becb6ce346a69fccccb1828e289ae4e4d3af8535.tar.xz bootstrap-becb6ce346a69fccccb1828e289ae4e4d3af8535.zip | |
Add dropdown responsive alignment (#26255)
Diffstat (limited to 'site/docs')
| -rw-r--r-- | site/docs/4.1/components/dropdowns.md | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/site/docs/4.1/components/dropdowns.md b/site/docs/4.1/components/dropdowns.md index ab61390d4..552631337 100644 --- a/site/docs/4.1/components/dropdowns.md +++ b/site/docs/4.1/components/dropdowns.md @@ -616,6 +616,44 @@ By default, a dropdown menu is automatically positioned 100% from the top and al {% endcapture %} {% include example.html content=example %} +### Responsive alignment + +If you want to use responsive alignment, disable dynamic positioning by adding the `data-display="static"` attribute and use the responsive variation classes. + +To align **right** the dropdown menu with the given breakpoint or larger, add `.dropdown-menu{-sm|-md|-lg|-xl}-right`. + +{% capture example %} +<div class="btn-group"> + <button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" data-display="static" aria-haspopup="true" aria-expanded="false"> + Left-aligned but right aligned when large screen + </button> + <div class="dropdown-menu dropdown-menu-lg-right"> + <button class="dropdown-item" type="button">Action</button> + <button class="dropdown-item" type="button">Another action</button> + <button class="dropdown-item" type="button">Something else here</button> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +To align **left** the dropdown menu with the given breakpoint or larger, add `.dropdown-menu-right` and `.dropdown-menu{-sm|-md|-lg|-xl}-left`. + +{% capture example %} +<div class="btn-group"> + <button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" data-display="static" aria-haspopup="true" aria-expanded="false"> + Right-aligned but left aligned when large screen + </button> + <div class="dropdown-menu dropdown-menu-right dropdown-menu-lg-left"> + <button class="dropdown-item" type="button">Action</button> + <button class="dropdown-item" type="button">Another action</button> + <button class="dropdown-item" type="button">Something else here</button> + </div> +</div> +{% endcapture %} +{% include example.html content=example %} + +Note that you don't need to add a `data-display="static"` attribute to dropdown buttons in navbars, since Popper.js isn't used in navbars. + ## Menu content ### Headers |
