#672: Add tabs unique ID for nested tabs, uses .Ordinal by default

This commit is contained in:
Alex Shpak 2025-01-30 22:01:36 +01:00
parent f889e52566
commit 60f4c03b8b
2 changed files with 2 additions and 2 deletions

View File

@ -3,7 +3,7 @@
Tabs let you organize content by context, for example installation instructions for each supported platform.
```tpl
{{%/* tabs */%}}
{{%/* tabs "id" */%}}
{{%/* tab "MacOS" */%}} # MacOS Content {{%/* /tab */%}}
{{%/* tab "Linux" */%}} # Linux Content {{%/* /tab */%}}
{{%/* tab "Windows" */%}} # Windows Content {{%/* /tab */%}}

View File

@ -1,4 +1,4 @@
{{- $group := printf "tabs-%d" .Parent.Ordinal -}}
{{- $group := printf "tabs-%s" (default .Parent.Ordinal (.Parent.Get 0)) -}}
{{- $tab := printf "%s-%d" $group .Ordinal }}
<input type="radio" class="toggle" name="{{ $group }}" id="{{ $tab }}" {{ if not .Ordinal }}checked="checked"{{ end }} />
<label for="{{ $tab }}">