@props([ 'tabs', 'contents' => [], 'icon', 'active' => null, 'justifyAlign' => 'start', 'isVertical' => false, ]) @if($tabs) @php // Если содержимое не передано, создаем его из слотов if ($contents === []) { $tabs = collect($tabs) ->mapWithKeys(fn($value, $name) => [ Str::camel($name) => $value ]) ->all(); $contents = collect($__laravel_slots ?? []) ->mapWithKeys(fn($contentSlot, $name) => [ Str::camel($name) => $contentSlot ]) ->filter(fn($contentSlot, $name) => array_key_exists($name, $tabs)) ->all(); } @endphp
class(['tabs']) }} x-data="tabs( '{{ $active ?? array_key_first($tabs) }}', {{ $isVertical ? 'true' : 'false' }} )" >
@foreach($contents as $tabId => $tabContent)
{!! $tabContent !!}
@endforeach
@endif