compose-theme/layouts/shortcodes/tab.html
2024-07-26 17:08:59 +02:00

17 lines
688 B
HTML

{{- $name := .Get 0 | default "Name Me!" }}
{{ $group := .Page.Scratch.Get "tabGroupIndex" | default 0 }}
{{ $index := .Page.Scratch.Get "tabElementIndex" | default 0 }}
<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 }}">
{{ markdownify .Inner }}
</div>
{{ .Page.Scratch.Set "tabElementIndex" (add 1 $index) }}