{{- $items := split (.Get "items") "," -}}
{{- $defaultIndex := int ((.Get "defaultIndex") | default "0") -}}

{{- if not $items -}}
  {{ errorf "no items provided" }}
{{- end -}}

<div class="hextra-scrollbar hx-overflow-x-auto hx-overflow-y-hidden hx-overscroll-x-contain">
  <div class="hx-mt-4 hx-flex hx-w-max hx-min-w-full hx-border-b hx-border-gray-200 hx-pb-px dark:hx-border-neutral-800">
    {{- range $i, $item := $items -}}
      <button
        class="hextra-tabs-toggle data-[state=selected]:hx-border-primary-500 data-[state=selected]:hx-text-primary-600 hx-mr-2 hx-rounded-t hx-p-2 hx-font-medium hx-leading-5 hx-transition-colors -hx-mb-0.5 hx-select-none hx-border-b-2 hx-border-transparent hx-text-gray-600 hover:hx-border-gray-200 hover:hx-text-black dark:hx-text-gray-200 dark:hover:hx-border-neutral-800 dark:hover:hx-text-white"
        role="tab"
        type="button"
        aria-controls="tabs-panel-{{ $i }}"
        {{- if eq $i $defaultIndex }} aria-selected="true" {{ end -}}
        {{- if eq $i $defaultIndex }} tabindex="0" {{ end -}}
        {{- if eq $i $defaultIndex }} data-state="selected"{{ end -}}
      >
        {{- $item -}}
      </button>
    {{- end -}}
  </div>
</div>
<div>
  {{- .Inner -}}
</div>
{{- /* Drop trailing newlines */ -}}
