tab.html 694 B

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