mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-03 15:24:19 +01:00
fd7cfac4cb
* Improve docs on Modals, Alerts, Offcanvas and Toasts close triggers examples * Update site/layouts/shortcodes/js-dismiss.html Co-authored-by: Julien Déramond <juderamond@gmail.com> --------- Co-authored-by: Mark Otto <markdotto@gmail.com> Co-authored-by: Julien Déramond <juderamond@gmail.com>
16 lines
561 B
HTML
16 lines
561 B
HTML
{{- /* Usage: js-dismiss "ComponentName" */ -}}
|
|
|
|
{{- $name := .Get 0 -}}
|
|
|
|
Dismissal can be achieved with the `data-bs-dismiss` attribute on a button **within the {{ $name }}** as demonstrated below:
|
|
|
|
```html
|
|
<button type="button" class="btn-close" data-bs-dismiss="{{ $name }}" aria-label="Close"></button>
|
|
```
|
|
|
|
or on a button **outside the {{ $name }}** using the additional `data-bs-target` as demonstrated below:
|
|
|
|
```html
|
|
<button type="button" class="btn-close" data-bs-dismiss="{{ $name }}" data-bs-target="#my-{{ $name }}" aria-label="Close"></button>
|
|
```
|