@php use Filament\Support\Enums\Width; $livewire ??= null; $hasTopbar = filament()->hasTopbar(); $isSidebarCollapsibleOnDesktop = filament()->isSidebarCollapsibleOnDesktop(); $isSidebarFullyCollapsibleOnDesktop = filament()->isSidebarFullyCollapsibleOnDesktop(); $hasTopNavigation = filament()->hasTopNavigation(); $hasNavigation = filament()->hasNavigation(); $renderHookScopes = $livewire?->getRenderHookScopes(); $maxContentWidth ??= (filament()->getMaxContentWidth() ?? Width::SevenExtraLarge); if (is_string($maxContentWidth)) { $maxContentWidth = Width::tryFrom($maxContentWidth) ?? $maxContentWidth; } @endphp $hasNavigation, 'fi-body-has-sidebar-collapsible-on-desktop' => $isSidebarCollapsibleOnDesktop, 'fi-body-has-sidebar-fully-collapsible-on-desktop' => $isSidebarFullyCollapsibleOnDesktop, 'fi-body-has-topbar' => $hasTopbar, 'fi-body-has-top-navigation' => $hasTopNavigation, ]) > @if ($hasTopbar) {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::TOPBAR_BEFORE, scopes: $renderHookScopes) }} @livewire(filament()->getTopbarLivewireComponent()) {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::TOPBAR_AFTER, scopes: $renderHookScopes) }} @if ($hasTopNavigation) @php $navigation = filament()->getNavigation() ?? collect(); $activeGroupLabel = $navigation->first(fn ($g) => $g->isActive())?->getLabel() ?? ''; @endphp {{-- Set sidebar width before first paint to prevent layout shift --}}
{{-- Toggle button --}}
Menu
{{-- Expanded: accordion --}}
@foreach ($navigation as $group) @php $groupLabel = $group->getLabel(); $isActive = $group->isActive(); $items = $group->getItems(); @endphp
@foreach ($items as $item) @php $isItemActive = $item->isActive(); $itemUrl = $item->getUrl(); $childItems = $item->getChildItems(); @endphp @if (count($childItems))

{{ $item->getLabel() }}

@foreach ($childItems as $child) {{ $child->getLabel() }} @endforeach @else {{ $item->getLabel() }} @endif @endforeach
@endforeach
{{-- Collapsed: icons only --}}
@foreach ($navigation as $group) @php $firstUrl = $group->getItems()->first()?->getUrl() ?? '#'; $isActive = $group->isActive(); @endphp $isActive]) title="{{ $group->getLabel() }}"> @endforeach
@endif @elseif ($hasNavigation)
! $isSidebarFullyCollapsibleOnDesktop, ]) >
@endif
{{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::LAYOUT_START, scopes: $renderHookScopes) }} @if ($hasNavigation)
@livewire(filament()->getSidebarLivewireComponent()) @endif
{{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::CONTENT_BEFORE, scopes: $renderHookScopes) }}
value}" : $maxContentWidth, ]) > {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::CONTENT_START, scopes: $renderHookScopes) }} {{ $slot }} {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::CONTENT_END, scopes: $renderHookScopes) }}
{{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::CONTENT_AFTER, scopes: $renderHookScopes) }} {{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::FOOTER, scopes: $renderHookScopes) }}
{{ \Filament\Support\Facades\FilamentView::renderHook(\Filament\View\PanelsRenderHook::LAYOUT_END, scopes: $renderHookScopes) }}