{{-- Tabs Component - shadcn-style Usage: Overview content Settings content Logs content --}} @props([ 'tabs' => [], 'active' => null, 'variant' => 'default', ]) @php $variantClasses = [ 'default' => [ 'container' => 'inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground', 'tab' => 'inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', 'active' => 'bg-background text-foreground shadow', 'inactive' => 'hover:bg-background/50 hover:text-foreground', ], 'pills' => [ 'container' => 'inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground', 'tab' => 'inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-all duration-150', 'active' => 'bg-background text-foreground shadow', 'inactive' => 'hover:bg-background/50 hover:text-foreground', ], 'buttons' => [ 'container' => 'flex gap-2', 'tab' => 'inline-flex items-center justify-center whitespace-nowrap rounded-md px-4 py-2 text-sm font-medium transition-colors duration-150', 'active' => 'bg-primary text-primary-foreground shadow', 'inactive' => 'bg-secondary text-secondary-foreground hover:bg-secondary/80', ], ]; $styles = $variantClasses[$variant] ?? $variantClasses['default']; $activeTab = $active ?? ($tabs[0] ?? null); @endphp
{{-- Tab Navigation --}}
@foreach($tabs as $tab) @php $tabName = is_array($tab) ? ($tab['name'] ?? $tab['label'] ?? '') : $tab; $tabLabel = is_array($tab) ? ($tab['label'] ?? $tab['name'] ?? '') : $tab; $tabIcon = is_array($tab) ? ($tab['icon'] ?? null) : null; $tabBadge = is_array($tab) ? ($tab['badge'] ?? null) : null; @endphp @endforeach
{{-- Tab Panels --}}
{{ $slot }}