Files
hugo/layouts/shortcodes/tabs.html
kbrianngeno 6330092560
Some checks failed
Blowfish Docs Deploy / build (push) Has been cancelled
Blowfish Docs Deploy / deploy (push) Has been cancelled
Test Build / Build Example Site (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Update Hugo version / updateBlowfish (push) Has been cancelled
First commit
Delete exampleSite
Add initial content, images & docker-compose.yml
Use extend-head.html for analytics
Set remote url to gitea.novicelab.io
Remove original .git due to "shallow update not allowed" error
2026-03-14 14:43:39 +00:00

53 lines
1.7 KiB
HTML

{{- .Store.Set "tab-index" 0 -}}
{{- $noop := .Inner -}}
{{- $group := .Get "group" -}}
{{- $default := .Get "default" -}}
<div
class="tab__container w-full"
{{ with $group }}data-tab-group="{{ . }}"{{ end }}
{{ with $default }}data-default-tab="{{ . }}"{{ end }}>
<div class="tab__nav" role="tablist">
<div class="flex flex-wrap gap-1">
{{- range $nTabs, $_ := .Store.Get "tabs" -}}
{{- $isActive := false -}}
{{- if $default -}}
{{- $isActive = eq $default (index . "label") -}}
{{- else -}}
{{- $isActive = eq $nTabs 0 -}}
{{- end -}}
<button
class="tab__button px-3 py-2 text-sm font-semibold border-b-2 border-transparent rounded-t-md hover:bg-neutral-200 dark:hover:bg-neutral-700 {{ if $isActive -}}
tab--active
{{- end }}"
role="tab"
aria-selected="{{ cond $isActive `true` `false` }}"
data-tab-index="{{ $nTabs }}"
data-tab-label="{{ index . "label" }}">
<span class="flex items-center gap-1">
{{ with index . "icon" }}
{{ partial "icon.html" . }}
{{ end }}
{{ index . "label" }}
</span>
</button>
{{- end -}}
</div>
</div>
<div class="tab__content mt-4">
{{- range $nTabs, $_ := .Store.Get "tabs" -}}
{{- $isActive := false -}}
{{- if $default -}}
{{- $isActive = eq $default (index . "label") -}}
{{- else -}}
{{- $isActive = eq $nTabs 0 -}}
{{- end -}}
<div class="tab__panel {{ if $isActive }}tab--active{{ end }}" data-tab-index="{{ $nTabs }}">
{{ index . "content" }}
</div>
{{- end -}}
</div>
</div>