From b59b75bc55ad9d5d2d0259f6b3364a7bcb82b033 Mon Sep 17 00:00:00 2001 From: Rohit Sharma Date: Tue, 20 Apr 2021 10:49:57 +0530 Subject: =?UTF-8?q?Dropdown=20=E2=80=94=20Add=20option=20to=20make=20the?= =?UTF-8?q?=20dropdown=20menu=20clickable=20(#33389)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/content/docs/5.0/components/dropdowns.md | 66 ++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) (limited to 'site/content/docs') diff --git a/site/content/docs/5.0/components/dropdowns.md b/site/content/docs/5.0/components/dropdowns.md index b5ded08a5..d29212790 100644 --- a/site/content/docs/5.0/components/dropdowns.md +++ b/site/content/docs/5.0/components/dropdowns.md @@ -903,6 +903,56 @@ Use `data-bs-offset` or `data-bs-reference` to change the location of the dropdo {{< /example >}} +### Auto close behavior + +By default, the dropdown menu is closed when clicking inside or outside the dropdown menu. You can use the `autoClose` option to change this behavior of the dropdown. + +{{< example >}} +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+{{< /example >}} + ## Sass ### Variables @@ -967,7 +1017,7 @@ Regardless of whether you call your dropdown via JavaScript or instead use the d ### Options -Options can be passed via data attributes or JavaScript. For data attributes, append the option name to `data-bs-`, as in `data-bs-offset=""`. +Options can be passed via data attributes or JavaScript. For data attributes, append the option name to `data-bs-`, as in `data-bs-offset=""`. Make sure to change the case type of the option name from camelCase to kebab-case when passing the options via data attributes. For example, instead of using `data-bs-autoClose="false"`, use `data-bs-auto-close="false"`. @@ -1007,6 +1057,20 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap

For more information refer to Popper's offset docs.

+ + + + + + -- cgit v1.2.3
autoCloseboolean | stringtrue +

Configure the auto close behavior of the dropdown:

+
    +
  • true - the dropdown will be closed by clicking outside or inside the dropdown menu.
  • +
  • false - the dropdown will be closed by clicking the toggle button and manually calling hide or toggle method. (Also will not be closed by pressing esc key)
  • +
  • 'inside' - the dropdown will be closed (only) by clicking inside the dropdown menu.
  • +
  • 'outside' - the dropdown will be closed (only) by clicking outside the dropdown menu.
  • +
+
popperConfig null | object | function