Skip to content

Coexistence with Filament

Themes are CSS skins over Filament’s own layout. The plugin does not replace the panel layout, the page shell, or any render hooks — it swaps only the two navigation Livewire components:

$panel
->sidebarLivewireComponent(ChromeSidebar::class)
->topbarLivewireComponent(ChromeTopbar::class);

Both views are copies of Filament’s stock livewire/sidebar / livewire/topbar with the navigation tree replaced. Every shell render hook (SIDEBAR_START, SIDEBAR_NAV_START, SIDEBAR_NAV_END, SIDEBAR_FOOTER, TOPBAR_*, GLOBAL_SEARCH_*, …), the tenant menu, global search, database notifications and the user menu stay where Filament puts them. When Filament’s own top navigation is active and chrome has no items to show, the topbar falls back to Filament’s stock top-navigation markup.

Internally, NavigationBridge converts Filament NavigationGroup / NavigationItem trees into chrome MenuItems, and MenuLayout splits them for the active navigation type.

Chrome navigation keeps the stock NavigationItem / NavigationGroup features:

  • badges (badge(), badge color, badgeTooltip())
  • openUrlInNewTab() and SPA mode (->spa(), prefetching, spaUrlExceptions()) via Filament’s generate_href_html()
  • extraAttributes() on items; extraSidebarAttributes() / extraTopbarAttributes() on groups
  • Htmlable labels rendered as HTML (like Filament); plain strings are escaped
  • aria-current="page" on the active item
  • group collapsible() / collapsed() with Filament’s persisted filament:sidebar:collapsed_groups state in Static mode; in Accordion mode the active group opens and the rest stay closed, and collapsible(false) groups render expanded

Chrome markup carries Filament’s stock class names alongside chrome classes, in stock-like <ul> / <li> nesting, so selectors from your theme CSS or other plugins keep matching — including child combinators such as .fi-sidebar-item > .fi-sidebar-item-btn:

fi-sidebar-item, fi-sidebar-item-btn, fi-sidebar-item-label, fi-sidebar-item-badge-ctn, fi-active, fi-sidebar-group, fi-sidebar-group-btn, fi-sidebar-group-label, fi-sidebar-group-items, data-group-label, fi-topbar-item, fi-topbar-item-btn, fi-topbar-item-label.

Stock paint for those classes is neutralized in chrome.css with zero-specificity resets, so themes stay in control.

chrome.css, the theme packs and chrome-nav.js are registered loadedOnRequest(). php artisan filament:assets publishes them, but only panels that register FilamentChromePlugin link them (via panel render hooks). Rules that target stock Filament classes are scoped to body.fi-chrome, so other panels — including ones reached through SPA navigation — are unaffected.

Hook Used for
STYLES_BEFORE Base chrome.css
STYLES_AFTER Google fonts, theme pack, accent variable, theme extraCss(), branding overrides
SCRIPTS_BEFORE chrome-nav.js
BODY_START Body attributes (theme, navigation type, offcanvas, treeline)
GLOBAL_SEARCH_AFTER (configurable) Theme switcher trigger, when enabled
BODY_END Theme switcher aside, when enabled

The plugin also sets $panel->colors(['primary' => …]) when a primary color resolves, $panel->font() from the theme’s fontFamily(), and $panel->topNavigation() for the Top navigation type.