aboutsummaryrefslogtreecommitdiff
path: root/docs/components/dropdowns.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/components/dropdowns.md')
-rw-r--r--docs/components/dropdowns.md45
1 files changed, 43 insertions, 2 deletions
diff --git a/docs/components/dropdowns.md b/docs/components/dropdowns.md
index 4da232b7d..13f49a32f 100644
--- a/docs/components/dropdowns.md
+++ b/docs/components/dropdowns.md
@@ -12,6 +12,13 @@ Dropdowns are toggleable, contextual overlays for displaying lists of links and
* Will be replaced with the ToC, excluding the "Contents" header
{:toc}
+## Overview
+
+Things to know when using the popover plugin:
+
+- Dropdown rely on the 3rd party library [Popper.js](https://popper.js.org) for positioning. You must include [popper.min.js](https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.9.9/umd/popper.min.js) before bootstrap.js in order for dropdowns to work!
+- Popper.js handle natively the flip of Dropdown when it's outside the viewport, if you want to disable that's behavior use `flip` attribute
+
## Examples
Wrap the dropdown's toggle (your button or link) and the dropdown menu within `.dropdown`, or another element that declares `position: relative;`. Dropdowns can be triggered from `<a>` or `<button>` elements to better fit your potential needs.
@@ -19,7 +26,7 @@ Wrap the dropdown's toggle (your button or link) and the dropdown menu within `.
{% callout info %}
### Dropdown menu accessibility
-The [<abbr title="Web Accessibility Initiative">WAI</abbr> <abbr title="Accessible Rich Internet Applications">ARIA</abbr>](https://www.w3.org/TR/wai-aria/) standard defines an actual [`role="menu"` widget](https://www.w3.org/TR/wai-aria/roles#menu), but this is specific to application-like menus which trigger actions or functions. <abbr title="Accessible Rich Internet Applications">ARIA</abbr> menus can only contain menu items, checkbox menu items, radio button menu items, radio button groups, and sub-menus.
+The [<abbr title="Web Accessibility Initiative">WAI</abbr> <abbr title="Accessible Rich Internet Applications">ARIA</abbr>](https://www.w3.org/TR/wai-aria/) standard defines an actual [`role="menu"` widget](https://www.w3.org/TR/wai-aria/roles#menu), but this is specific to application-like menus which trigger actions or functions. <abbr title="Accessible Rich Internet Applications">ARIA</abbr> menus can only contain menu items, checkbox menu items, radio button menu items, radio button groups, and sub-menus.
Bootstrap's dropdowns, on the other hand, are designed to be generic and applicable to a variety of situations and markup structures. For instance, it is possible to create dropdowns that contain additional inputs and form controls, such as search fields or login forms. For this reason, Bootstrap does not expect (nor automatically add) any of the `role` and `aria-` attributes required for true <abbr title="Accessible Rich Internet Applications">ARIA</abbr> menus. Authors will have to include these more specific attributes themselves.
@@ -527,13 +534,47 @@ Regardless of whether you call your dropdown via JavaScript or instead use the d
### Options
-*None.*
+Options can be passed via data attributes or JavaScript. For data attributes, append the option name to `data-`, as in `data-placement=""`.
+
+<table class="table table-bordered table-striped table-responsive">
+ <thead>
+ <tr>
+ <th style="width: 100px;">Name</th>
+ <th style="width: 100px;">Type</th>
+ <th style="width: 50px;">Default</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>placement</td>
+ <td>string</td>
+ <td>'bottom'</td>
+ <td>
+ <p>How to position the popover - top | bottom.</p>
+ </td>
+ </tr>
+ <tr>
+ <td>offset</td>
+ <td>number | string</td>
+ <td>0</td>
+ <td>Offset of the dropdown relative to its target. For more information refer to Popper.js's <a href="https://popper.js.org/popper-documentation.html#modifiers..offset.offset">offset docs</a>.</td>
+ </tr>
+ <tr>
+ <td>flip</td>
+ <td>boolean</td>
+ <td>true</td>
+ <td>Allow Dropdown to flip in case of an overlapping on the reference element. For more information refer to Popper.js's <a href="https://popper.js.org/popper-documentation.html#modifiers..flip.enabled">flip docs</a>.</td>
+ </tr>
+ </tbody>
+</table>
### Methods
| Method | Description |
| --- | --- |
| `$().dropdown('toggle')` | Toggles the dropdown menu of a given navbar or tabbed navigation. |
+| `$().dropdown('update')` | Updates the position of an element's dropdown. |
### Events