mirror of
https://github.com/twbs/bootstrap.git
synced 2022-11-09 12:25:43 -05:00

* use a streamlined way to trigger component dismiss * add documentation Co-authored-by: XhmikosR <xhmikosr@gmail.com>
15 lines
539 B
HTML
15 lines
539 B
HTML
{{- /* Usage: js-dismiss "ComponentName" */ -}}
|
|
|
|
{{- $name := .Get 0 -}}
|
|
|
|
Dismissal can be achieved with the `data` 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 `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>
|
|
```
|