tab.html (694B)
1 {{ $group := .Page.Scratch.Get "tabGroupIndex" | default 0 }} 2 {{ $index := .Page.Scratch.Get "tabElementIndex" | default 0 }} 3 {{ $name := .Get "name" | default "Name Me!" }} 4 5 <style> 6 .tabs input#tab-{{ $group }}-{{ $index }}:checked ~ .tab-content-{{ $group }}-{{ $index }} { 7 display: block; 8 } 9 </style> 10 11 <input type="radio" class="tab-input" name="tab-select-{{ $group }}" id="tab-{{ $group }}-{{ $index }}" {{ if eq $index 0 }}checked{{ end }}/> 12 <label for="tab-{{ $group }}-{{ $index }}" class="tab-label">{{ $name }}</label> 13 <div class="tab-content tab-content-{{ $group }}-{{ $index }}"> 14 {{ .Inner | markdownify }} 15 </div> 16 17 {{ .Page.Scratch.Set "tabElementIndex" (add 1 $index) }}