2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-14 18:42:30 +03:00

Use a streamlined way to trigger component dismiss (#34170)

* use a streamlined way to trigger component dismiss

* add documentation

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
GeoSot
2021-07-28 17:39:32 +03:00
committed by GitHub
parent 047145e808
commit 4bfd8a2cbc
12 changed files with 184 additions and 71 deletions
+1 -11
View File
@@ -204,17 +204,7 @@ See the [triggers](#triggers) section for more details.
### Triggers
Dismissal can be achieved with `data` attributes on a button **within the alert** as demonstrated above:
```html
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
```
or on a button **outside the alert** using the `data-bs-target` as demonstrated above:
```html
<button type="button" class="btn-close" data-bs-dismiss="alert" data-bs-target="#my-alert" aria-label="Close"></button>
```
{{% js-dismiss "alert" %}}
**Note that closing an alert will remove it from the DOM.**