Crafting Vue Modals
In this course, I'll show you how to build dynamic, responsive modal components using Vue 3 and Inertia.js. In each episode, I'll introduce new techniques, such as smooth transitions, click-outside behavior, URL-based modals, comprehensive testing with Laravel Dusk, and much more.
We'll begin with the essentials, and then incrementally dig further into some fairly complex techniques. So buckle up!
Progress
Series Info
- Episodes
- 14
- Run Time
- 2h 8m
- Difficulty
- Advanced
- Last Updated
- Apr 15, 2025
- Version
- Latest
Series Episodes
- Modal Essentials (6)
Basic User Edit Modal
In this first episode, we'll implement a modal in a Laravel Breeze app with Vue and Inertia.js to update user information. This component will serve as the basis for our entire modal system.Reusable Modal Component
Building on our initial implementation, we extract the modal into a reusable Vue component, enabling us to use it throughout the application while cleaning up the index page.Smooth Transitions
Everyone appreciates a smooth user experience, so we'll implement fade and scale effects to enhance the modal's responsiveness and visual appeal.Escape Key And Outside Clicks
Accessibility matters! In this episode, we'll enhance our modal by implementing keyboard support and click-outside behavior.Configurable Modal
Flexibility is key to a truly reusable component. We'll add configuration options for size, title, and close behavior to ensure our modal remains adaptable.Reusable Edit Modal
We'll extract our modal to the global components directory and implement it on a different page to confirm that it's no longer tied to a specific page.
- Backend-Powered Modals (2)
Backend Powered Modal System
Taking our modal system to the next level, we'll integrate a backend that loads modals based on URLs, retrieving components and their props from the server.Improving The Backend Powered Modal
Our backend-powered modal needs further refinements to ensure transitions function properly. We'll also resolve a layout issue and enhance the styling slightly.
- URL-Based Modals (3)
Backend Setup
Backend-powered modals are great, but what if we could link to them directly? We'll implement a URL-based modal system that opens modals using a URL. In this episode, we'll focus solely on the backend setup.Frontend Implementation
Now that the backend is ready, we'll implement the frontend logic to handle URL-based modals. This includes integrating with the browser history and router, as well as managing the modal state.Redirection Handling
We're almost finished with our URL-based modal system. In this episode, we'll address the necessary changes to ensure redirects work correctly when forms are submitted within a modal.
- Testing and Refactoring (3)
E2E Testing With Laravel Dusk
Before proceeding with further cleanup and refactoring, we'll write an end-to-end test for our modal system using Laravel Dusk, allowing us to refactor confidently.E2E Testing Refactor
Although our tests are passing, our test code contains significant duplication. We'll refactor our Dusk tests to use a custom browser class and Pest datasets to enhance readability and maintainability.Refactor And Cleanup
In this final episode, we'll tidy up our codebase, reorganize components, and verify that everything is working as expected.