emargareten/inertia-modal
Inertia Modal lets Laravel and Inertia.js apps render pages as modals without extra routes or controllers, keeping server-side routing intact and navigation fast.
Architecture fit. Inertia already makes the server the source of truth for page state: every navigation returns a component name plus props. A "backend-driven modal" package formalizes the pattern of encoding modal identity and open/close state in that response rather than in client-side stores. That is philosophically aligned with Inertia and shrinks a whole class of bugs where client state and server intent disagree — e.g., a controller decides a modal should reopen after a failed-validation redirect, and the server, not a useEffect, owns that decision. Fit is strongest where modals are tied to server-side workflows (confirm-delete, edit forms, wizard steps, post-redirect feedback) and weakest for purely presentational or ephemeral UI (command palettes, dropdowns, tooltips).
Integration feasibility. The typical shape is small and well-understood: composer require emargareten/inertia-modal, Laravel package discovery registers a service provider, a middleware or trait contributes modal state to the response, and a single host component rendered in the persistent layout reads shared props and mounts the correct modal component. That means one layout change, one dependency, no build-step or infrastructure change. Confirm before committing: which frontend adapters are supported (Vue 3 / React / Svelte), whether the host component is published or imported from the package, and whether any config or middleware registration is required.
Technical risk.
inertiajs/inertia-laravel and the client adapter. Inertia v2's deferred props, prefetching, polling, and partial reloads change how props arrive; modal state delivered as a normal prop may behave differently under an only= partial reload or a prefetch than under a full page visit. This is the highest-risk area and should be the first thing tested in a spike.aria-modal, Escape handling, and focus restoration are easy to get wrong and are not obviously in scope for a package this size. Validate against WCAG 2.2 dialog expectations; you may need to lean on Headless UI, Radix, or Melt UI underneath rather than trusting the package's defaults.Key questions for the maintainer or spike.
Stack fit. Laravel + inertiajs/inertia-laravel + Vue/React/Svelte + Vite. No queue, no external service, no infrastructure change — a pure application-layer dependency. That makes it low blast radius and cheap to trial.
Compatibility. Pin to a minor version and add an explicit constraint in composer.json, verifying PHP and Laravel support from the manifest rather than the README. Add a CI job that runs the modal test suite against the Inertia version you actually ship, and include the package in your routine composer outdated review. The recent 2026-09-15 release suggests active maintenance but also that the API may still be settling — avoid depending on undocumented internals.
Migration path. Do not attempt a big-bang rewrite of existing modals.
Sequencing. Backend contract first (controllers and session handling), then the layout host component, then per-feature migrations, then cleanup. Schedule the accessibility review before the rollout step, not after — retrofitting focus management across a dozen migrated modals is far more expensive than fixing the shared host once.
Maintenance. Low ongoing code cost, non-trivial dependency cost. Budget a recurring line item: review the package on every Inertia and Laravel major upgrade, and keep a fork or extraction plan warm. The surface is likely small enough that a one-to-two-day internal reimplementation is a credible exit — decide in advance that you would do this, rather than deciding under pressure during an incident.
Support. MIT, community-only. No SLA and no vendor to escalate to. For business-critical flows (checkout, destructive confirmations) that means your team owns the failure entirely. Keep the blast radius narrow: prefer this package for convenience flows, and hesitate before making it the mechanism for revenue-critical dialogs until it has survived a few release cycles.
Scaling. Runtime cost is negligible — a modal is one component render. The real concerns are payload and query shape. If modal props are shared globally, every non-modal page load pays for data it never uses; use Inertia's deferred or optional props for modal-only data and keep large collections out of the shared payload. Watch for N+1s where a modal loads its own relation, and for prop accretion — a shared modal prop that grows a field per feature is a smell worth catching in review.
Failure modes to monitor.
only=.Instrument with a small end-to-end check in CI (a Playwright or Dusk test covering redirect → modal opens → dismiss → Back) so regressions surface in the pipeline rather than in user reports.
Ramp-up. Low for anyone already fluent in Laravel and Inertia — the mental shift is "the server decides the modal is open," which is a smaller leap than it sounds. Expect roughly half a day of onboarding plus a written convention doc. The genuine cost sits with frontend engineers learning the host component's contract and the team's accessibility expectations. Two risks worth pre-empting: developers accustomed to client-state modals will keep reaching for local state, and reviewers won't know the transport semantics well enough to catch state-loss bugs. Address both with the convention doc and one exemplar PR that the whole team reviews together.
How can I help you explore Laravel packages today?