@props([
'id' => null,
'tabs' => [],
'default' => null,
'label' => null,
])
@php
$label = $label ?: __('kview-ui-core::ui.navigation.section');
$componentId = $id ?: 'ui-tabs-'.str()->random(8);
$activeTab = (string) ($default ?: ($tabs[0]['id'] ?? ''));
@endphp
class('ui-tabs')->merge([
'id' => $componentId,
'data-ui-tabs' => true,
'data-default-tab' => $activeTab,
]) }}
>
@foreach ($tabs as $tab)
@php
$tabKey = (string) ($tab['id'] ?? $loop->index);
$isActive = $tabKey === $activeTab;
$triggerId = $componentId.'_'.$tabKey.'_tab';
$panelId = $componentId.'_'.$tabKey.'_panel';
@endphp
@endforeach
{{ $slot }}