1. Go to this page and download the library: Download jibaymcs/tabbed library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jibaymcs / tabbed example snippets
use JibayMcs\Tabbed\TabbedPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
TabbedPlugin::make(),
]);
}
use JibayMcs\Tabbed\Traits\HasTabbedActions;
class UserResource extends Resource
{
use HasTabbedActions;
// Your resource code — no other changes needed
}
use JibayMcs\Tabbed\Actions\OpenInTabAction;
public static function table(Table $table): Table
{
return $table
->recordActions([
OpenInTabAction::make(),
// ...other actions
]);
}
OpenInTabAction::make()
->tabbedPage('view') // Target page: edit, view, create, index (default: from config)
->background() // Open tab without switching to it
->tabName(fn ($record) => $record->name) // Custom tab label
->resource(UserResource::class) // Explicit resource (auto-detected by default)
->openFor(fn ($record) => $record->author) // Resolve target record from parent context (see below)
->tabColor(Color::Red) // Accent color (left border indicator)
->tabBackground(Color::Red) // Background color
->tabTextColor(Color::Red) // Text color
->confirmOnClose() // Ask confirmation before closing if dirty
->closeOnSave() // Auto-close the tab after a successful save
use App\Filament\Resources\Contacts\ContactResource;
use App\Models\Ticket;
OpenInTabAction::make()
->resource(ContactResource::class) // The tab opens a Contact…
->tabbedPage('view')
->openFor(fn (Ticket $record) => $record->contact) // …resolved from the parent Ticket
->visible(fn (Ticket $record) => $record->contact !== null) // Hide when no contact linked
->tabName(fn ($record) => $record->fullname); // $record here = the resolved Contact
OpenInTabAction::make()
->canReorder(false) // Prevent drag & drop for this tab
->canRename(fn ($record) => $record->is_editable) // Conditional rename
->canPin(fn ($record) => $record->is_important) // Conditional pin
->canDuplicate(true) // Allow duplication (default)
->canClose(fn ($record) => ! $record->is_locked) // Prevent closing locked records
use Filament\Support\Colors\Color;
// Filament Color palette (shade picked automatically)
OpenInTabAction::make()
->tabColor(Color::Red) // border: shade 500
->tabBackground(Color::Red) // background: shade 50
->tabTextColor(Color::Red) // text: shade 700
// Specific shade from a palette
OpenInTabAction::make()
->tabColor(Color::Blue[600])
// Hex, rgb, rgba
OpenInTabAction::make()
->tabColor('#ef4444')
->tabBackground('rgba(254, 242, 242, 0.8)')
->tabTextColor('#991b1b')
use JibayMcs\Tabbed\Enums\HoverCardPosition;
use Illuminate\Support\HtmlString;
// Blade view with record data
OpenInTabAction::make()
->hoverCardContent(fn ($record) => view('partials.tab-preview', ['record' => $record]))
->hoverCardPosition(HoverCardPosition::Bottom)
// Inline HTML
OpenInTabAction::make()
->hoverCardContent(fn ($record) => new HtmlString("<strong>{$record->name}</strong><br>{$record->email}"))
->hoverCardDelay(400) // Delay before showing (default: 600ms)
->hoverCardLeaveDelay(300) // Delay before hiding (default: 500ms)
// Plain text
OpenInTabAction::make()
->hoverCardContent(fn ($record) => "#{$record->id} - {$record->name}")
->hoverCardPosition(HoverCardPosition::Top)
// Disable hover card
OpenInTabAction::make()
->hoverCard(false)
TabbedPlugin::make()
->defaultPage('view') // Default page on open (default: edit)
->renderHook(PanelsRenderHook::TOPBAR_LOGO_AFTER) // Tab bar position (default: TOPBAR_LOGO_AFTER)
->persistKey('my_panel_tabs') // localStorage key (default: tabbed_tabs)
->middleClickToClose() // Close tabs with middle mouse button (default: off)
->showTabIcons(false) // Hide resource icons in tabs (default: true)
->lazyLoad() // Only load tab content on first activation (default: off)
->destroyInactive() // Destroy inactive tab components to save memory (default: off)
->confirmClose() // Confirm before closing tabs with unsaved changes (default: off)
->interceptRedirects() // Block post-save redirects inside tabs (default: on)
->allowReorder(false) // Disable drag & drop reordering (default: on)
->allowRename(false) // Disable inline tab renaming (default: on)
->allowPin(false) // Disable tab pinning (default: on)
->allowDuplicate(false) // Disable tab duplication (default: on)
->allowCloseOthers(false) // Hide "Close others" from context menu (default: on)
->allowCloseAll(false) // Hide "Close all" from context menu (default: on)
->keyboardShortcuts() // Enable keyboard shortcuts with defaults (default: off)
// Enable with default shortcuts
TabbedPlugin::make()->keyboardShortcuts()
// Custom shortcuts
TabbedPlugin::make()->keyboardShortcuts(
nextTab: 'ctrl+alt+right', // Next tab (default)
prevTab: 'ctrl+alt+left', // Previous tab (default)
closeTab: 'alt+w', // Close active tab (default)
reopenTab: 'alt+shift+t', // Reopen last closed tab (default)
)
// Disable
TabbedPlugin::make()->keyboardShortcuts(false)
// Lazy load: components are created only when a tab is activated for the first time.
// Once loaded, they stay in memory (state preserved on switch).
TabbedPlugin::make()->lazyLoad()
// Destroy inactive: only the active tab has a Livewire component in the DOM.
// Switching tabs destroys the previous component and creates the new one.
// Saves memory but loses form state on switch. Implies lazyLoad.
TabbedPlugin::make()->destroyInactive()
// Keep alive: keep the N most recently visited tabs in memory (LRU).
// Tabs beyond this limit are destroyed. Combines fast switching with memory savings.
TabbedPlugin::make()->destroyInactive(keepAlive: 3)
// Global: all dirty tabs ask confirmation before closing
TabbedPlugin::make()->confirmClose()
// Per-tab: only specific actions ask confirmation
OpenInTabAction::make()->confirmOnClose()
// Both can be combined: global acts as a default, per-tab overrides
TabbedPlugin::make()->confirmClose()
// A tab without ->confirmOnClose() will still ask because of the global setting
// Disable redirect interception globally (saves redirect normally)
TabbedPlugin::make()->interceptRedirects(false)
// Auto-close a tab after successful save (serial processing workflow)
OpenInTabAction::make()->closeOnSave()
use Filament\View\PanelsRenderHook;
// In the topbar (after the logo)
TabbedPlugin::make()->renderHook(PanelsRenderHook::TOPBAR_LOGO_AFTER)
// At the start of the page content
TabbedPlugin::make()->renderHook(PanelsRenderHook::PAGE_START)
// Inside the main content area
TabbedPlugin::make()->renderHook(PanelsRenderHook::CONTENT_START)