summaryrefslogtreecommitdiffstats
path: root/site/layouts/shortcodes/js-dismiss.html
diff options
context:
space:
mode:
Diffstat (limited to 'site/layouts/shortcodes/js-dismiss.html')
-rw-r--r--site/layouts/shortcodes/js-dismiss.html15
1 files changed, 15 insertions, 0 deletions
diff --git a/site/layouts/shortcodes/js-dismiss.html b/site/layouts/shortcodes/js-dismiss.html
new file mode 100644
index 0000000..45d72d0
--- /dev/null
+++ b/site/layouts/shortcodes/js-dismiss.html
@@ -0,0 +1,15 @@
+{{- /* 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>
+```