jeffersongoncalves/filament-panel-theme-isolation
Isolate Filament panel themes so each panel renders its own styles without leaking into others. Keep multiple panels visually independent, avoid CSS conflicts, and simplify theme customization in one lightweight package.
Architecture fit. The package is a thin Filament v3 plugin that scopes dark/light theme persistence to a per-panel localStorage key. Architecturally it sits entirely in the presentation layer: a service provider registered via the panel's ->plugin() chain, plus a small front-end asset that reads/writes a prefixed key. It introduces no models, migrations, routes, middleware, or config surface that would touch application domain logic. For a Filament application with two or more panels on a single origin (e.g. admin and app, or admin and portal), this addresses a real and commonly reported defect: Filament's default theme key is origin-scoped, so toggling dark mode in one panel silently flips the other. The scope is narrow and the blast radius is correspondingly small.
Integration feasibility. High. Expected install path is composer require followed by one line in each PanelProvider. No publish step is implied by the notes, no migration, no env vars. Realistic effort is well under an hour including verification, assuming the plugin registers cleanly against the consuming project's Filament minor version.
Technical risk.
Key questions.
->darkMode() / ->darkMode(false) configuration, or does it force isolation onto panels that opted out?Stack fit. Assumes Laravel 10+ on PHP 8.1+ and Filament v3. This aligns with a current-generation Laravel estate; teams still on Laravel 9 or Filament v2 are excluded outright. Confirm the project's actual Filament constraint before committing — ^3.x versus a pinned minor matters given the internal coupling noted above.
Migration path. Effectively zero-data-migration. Sequence: (1) add the Composer dependency in a feature branch, (2) register the plugin on one non-critical panel, (3) verify dark-mode toggle, persistence across reload, and no flash, (4) register on remaining panels, (5) ship. Rollback is symmetric and clean: remove the ->plugin() lines, then composer remove. The one user-visible side effect is a one-time preference reset — existing users carry a preference under Filament's original key that the new prefixed key will not read, so everyone reverts to the default theme once. Worth a release note; not worth engineering around.
Compatibility. Single hard boundary: Filament v3 only. Filament v4 is not claimed, and given that the package touches theme bootstrap internals, budget for a fork-or-replace decision at the v4 upgrade rather than assuming a drop-in. Laravel and PHP floors are permissive enough to be non-issues. No stated conflict with spatie/laravel-permission multi-panel setups, which is the most common multi-panel pattern in this ecosystem — verify explicitly, since panel switching there is routine.
Sequencing. Low-urgency, low-coupling work. Best slotted alongside or immediately after any existing multi-panel UX cleanup, not as a standalone initiative. If a Filament major upgrade is within two quarters, defer and fold the fix into that work instead — otherwise you pay the integration cost twice.
Maintenance. Minimal ongoing effort: no scheduled jobs, no storage growth, no server-side state. The real cost is dependency-tracking — a small, single-maintainer package that must be re-validated on every Filament upgrade. Pin the version and add it to the Filament-upgrade checklist. Given the small code footprint, forking into the application as first-party code is a legitimate alternative that removes the supply-chain question entirely.
Support. Assume no SLA and community-only issue triage. Acceptable for a cosmetic theme concern; the worst-case failure is users seeing the wrong theme, not data loss or outage. That asymmetry is what makes the risk tolerable. Do not adopt if the same mechanism is later extended to anything security- or preference-critical without internal ownership.
Scaling traffic / data. Negligible. Purely client-side; no requests, no cache, no database. Scales identically at ten users or ten million. No capacity planning required.
Failure modes. Ranked by likelihood and impact:
Ramp-up. Near-zero. Any developer comfortable with Filament panel providers can install, verify, and reason about this in under an hour; the concept requires no explanation beyond "the theme key is now per-panel." Documentation burden is a paragraph in the internal stack notes. The only knowledge worth institutionalizing is the verification procedure for flash and for post-upgrade isolation, since those are the two failure modes that will not announce themselves.
How can I help you explore Laravel packages today?