arnelirobles/laravel-rnx
A small Laravel package by arnelirobles that adds RNX support to Laravel applications. Install it via Composer and check the repository README for setup and usage details. Lightweight and early-stage, it fits simple projects or experimentation rather than large production systems.
Architecture fit
Despite being framed as a Laravel/PHP package, every change in v2.3.0 lands in the front-end asset layer: css/rnx.css, css/plugins.css, the Tailwind theme, and a JS mode API (setMode / getMode / getResolvedMode). There are no Composer, config, migration, service-provider, or Blade-side changes called out. The package therefore behaves as a UI kit vendored into a Laravel app via vendor:publish + Vite, not as a PHP integration surface. That is a good fit for Blade/Livewire/Inertia hosts that already compile Tailwind, but it means the theme state lives entirely in the browser (localStorage['rnx-mode'] + data-mode on <html>), so the server can never render the correct theme on first response. Theming now spans three attributes — data-mode, data-theme, and Bootstrap's data-bs-theme — which is three sources of truth for one concern.
Integration feasibility
Mechanically easy: publish assets, import CSS, call setMode. The friction is the Tailwind change. Teams that remapped colors.indigo (or any palette key) in tailwind.config.js will silently lose those overrides, because the theme now reads --rnx-* variables with the old hexes as fallbacks. Nothing fails loudly — the UI just reverts to stock colours. That is a customization-breaking change shipped in a minor version, and it needs a config audit before bumping. The color-mix() dependency (tints, hover fills, focus rings) also imposes a browser floor — Chrome 111, Safari 16.2, Firefox 113 — that must be reconciled with the host app's browserslist and any locked-down enterprise browser fleet.
Technical risk
data-mode from JS means a light flash for dark-mode users unless a blocking inline init script is added in <head>. No such snippet is mentioned.--rnx-* overrides.setMode writes data-bs-theme, which will fight any existing Bootstrap 5.3 theme toggle in the host app.wire:navigate and Turbo swaps don't re-run <head> scripts by default; mode application and prefers-color-scheme listeners may not re-attach or may leak.Key questions
setMode idempotent and listener-cleaning on repeat calls and on wire:navigate/Turbo page swaps?color-mix() — polyfill, static fallback colours, or accept the degradation?--rnx-* tokens?Stack fit
Laravel 10/11 + Vite + Tailwind (config-driven) + Bootstrap 5.3 + Blade/Livewire/Inertia. The package slots in at the compiled-asset layer with no PHP runtime footprint; Bootstrap 5.3 alignment is handled for free via data-bs-theme. Alpine works cleanly with data-mode as a reactive attribute. The main fit caveat is SSR/Blade: because the server has no knowledge of theme choice, any server-rendered markup that bakes in colours must read tokens, not literal hexes.
Migration path
^2.tailwind.config.js and any CSS for palette overrides (colors.indigo, brand key remaps) and inventory them.--rnx-* token declaration — verify the fallback behaviour first, since a no-op migration should be visually identical.<head> before any stylesheet-dependent paint.setMode behind the existing toggle (or replace the existing toggle) and remove any competing data-bs-theme manager.Compatibility
Functional compatibility is broad; visual compatibility requires Chrome 111 / Safari 16.2 / Firefox 113 for tints, hover fills, and focus rings. Confirm the host's browserslist and Tailwind targets, and decide explicitly whether to raise them or accept degraded affordances. Bootstrap 5.3 is now effectively required for the data-bs-theme behaviour to be meaningful. localStorage availability in private/blocked-storage contexts needs a graceful no-op path.
Sequencing Split into two shippable steps: (a) token migration with zero intended visual change, then (b) dark-mode enablement. Land (b) behind a feature flag or a single canary route, observe for a release cycle, then roll out. Do not bundle this with other UI or design-system work — the palette change and the browser-floor decision both need clean attribution if something regresses. Avoid shipping near a release freeze given the first-paint and contrast risks.
Maintenance
The --rnx-* token set is now a public API surface owned by the package; treat it as such and pin versions. Hosts that override tokens take on permanent maintenance of a parallel theme, including dark variants that the package's tests will not cover. Dual attribute management (data-mode / data-theme / data-bs-theme) is a small but recurring source of drift that should be centralised in one helper, not scattered across toggles.
Support
Expect three ticket classes: "our brand colours stopped applying" (Tailwind remap no longer honoured), "dark mode flashes light on load" (missing pre-paint script), and "hover/focus styling disappeared on older Safari/Chrome" (color-mix() floor). Write a short internal runbook covering the token mapping table, the init snippet, and the browser-floor statement. Note that mode preference is per-browser and per-device — users will report inconsistency across devices, which is expected behaviour, not a bug, unless server-side persistence is added.
Scaling
Effectively zero server-side cost: no queries, no queues, no PHP memory. The scaling concerns are payload and cache. CSS grows from the dark token block, the newly emitted spacing utilities, and color-mix() expressions — measure the gzipped delta and confirm it stays inside the CSS budget. Both css/rnx.css and css/plugins.css changed, so CDN/browser cache invalidation must be handled deliberately (hashed filenames via Vite are the clean answer). prefers-color-scheme listeners are per-tab and cheap, but must be torn down on navigation to avoid accumulation in long-lived SPA sessions.
Failure modes
setMode both writing data-bs-theme yields flicker or a stuck theme.localStorage — private mode or storage-partitioned contexts; setMode must degrade to in-memory only.Ramp-up Low for any developer comfortable with Tailwind and CSS custom properties: roughly half a day for the token migration and init script on a mid-size app, plus a QA cycle for dark mode across every component in both Bootstrap and Tailwind surfaces. The two items that require real judgement rather than mechanical work are the browser-floor decision and the contrast audit of host-supplied tokens — both should be owned by someone with accessibility accountability, not delegated to the implementer.
How can I help you explore Laravel packages today?