simoncor.net/themes/hugo-coder/layouts/shortcodes/tab.html
Simon Cornet 956e73d0e4
All checks were successful
Build and Publish / Build (push) Successful in 5s
Build and Publish / Deployment (push) Successful in 58s
[hugo] feat: update
2024-08-26 17:13:18 +02:00

18 lines
694 B
HTML

{{ $group := .Page.Scratch.Get "tabGroupIndex" | default 0 }}
{{ $index := .Page.Scratch.Get "tabElementIndex" | default 0 }}
{{ $name := .Get "name" | default "Name Me!" }}
<style>
.tabs input#tab-{{ $group }}-{{ $index }}:checked ~ .tab-content-{{ $group }}-{{ $index }} {
display: block;
}
</style>
<input type="radio" class="tab-input" name="tab-select-{{ $group }}" id="tab-{{ $group }}-{{ $index }}" {{ if eq $index 0 }}checked{{ end }}/>
<label for="tab-{{ $group }}-{{ $index }}" class="tab-label">{{ $name }}</label>
<div class="tab-content tab-content-{{ $group }}-{{ $index }}">
{{ .Inner | markdownify }}
</div>
{{ .Page.Scratch.Set "tabElementIndex" (add 1 $index) }}