Vue.js Introduction — Essentials for Inertia × Laravel
An introduction to Vue.js for Laravel developers. Covers the Options API vs Composition API, Inertia v3 page components, useForm, shared data, and Vue 3 reactivity essentials.
Vue.js (Vue) is a progressive JavaScript framework for building user interfaces. “Progressive” means you can start small and add features as you need them — from sprinkling reactivity into an existing HTML page to building a full SPA.The core of Vue is reactivity: when your data changes, the DOM updates automatically. You never need to manually track which element to update and when.
This page covers Vue 3 paired with Inertia v3. Laravel 13 starter kits use this combination by default.
Vue 3 offers two styles for writing components: Options API and Composition API.Options API is the traditional style carried over from Vue 2. You define your component using an options object with keys like data, methods, computed, and mounted.
Composition API was introduced in Vue 3. Combined with <script setup> syntax, it lets you write more concise components with better logic reuse and TypeScript support.
<!-- Composition API (<script setup>) example --><script setup>import { ref } from 'vue'const count = ref(0)function increment() { count.value++}</script><template> <button @click="increment">{{ count }}</button></template>
The Inertia × Laravel starter kits use Composition API with <script setup> as the standard style. All examples on this page follow that convention.
Vue and Laravel go way back. Laravel 5.3 (2016) adopted Vue as the default frontend framework. The generated package.json included Vue, and a sample resources/js/components/ExampleComponent.vue shipped with every new project.Laravel 6 (2019) extracted authentication scaffolding into the separate laravel/ui package, taking the Vue scaffolding with it. Today, the recommended approach is to choose Inertia + Vue through the laravel new starter kit prompt.
The mainstream way to use Vue with Laravel is Inertia × Vue. Inertia lets you pass data directly from a Laravel controller to a Vue component — no API design required. This “modern monolith” architecture gives you SPA-like UX without the overhead of a separate API layer.
To add Vue to an existing project, install the server-side and client-side packages separately.
# Server side (PHP)composer require inertiajs/inertia-laravel# Client side (JavaScript)npm install @inertiajs/vue3 vuenpm install --save-dev @vitejs/plugin-vue
The <Form> component from @inertiajs/vue3 is the recommended form-submission style used in the starter kit’s authentication pages. You specify action and method as props and access errors and processing via v-slot.
v-slot="{ errors, processing }" is Vue’s scoped slot syntax — the Form component computes and injects these values automatically. Form fields use the native name attribute instead of v-model, so the browser’s standard form data collection handles serialisation.
The starter kit uses Wayfinder to manage routes as objects. store.form() returns an object containing action and method which is spread onto <Form> via v-bind.
<script setup lang="ts">import { Form } from '@inertiajs/vue3'import { store } from '@/routes/login'</script><template> <Form v-bind="store.form()" :reset-on-success="['password']" v-slot="{ errors, processing }" class="flex flex-col gap-6" > <!-- form body --> </Form></template>
reset-on-success lists fields to clear after a successful submission — useful for password fields that should be emptied after the form is sent.
Without Wayfinder, passing the URL directly (action="/login") works just the same.
Use the useForm helper from @inertiajs/vue3 for form handling. It manages form state, submission, and validation error display with minimal boilerplate.
true while a request is in flight (use to disable the submit button)
form.isDirty
true when the form differs from its initial values
form.post(url)
Submit via POST
form.put(url)
Submit via PUT (for updates)
form.delete(url)
Submit via DELETE
form.reset()
Reset the form to its initial values
When validation errors come back, useForm preserves the entered values and surfaces the errors. Combined with v-model, you get a seamless form experience.
Vue.js is a natural fit for Laravel, especially in the Inertia “modern monolith” setup.
Piece
Role
Laravel controller
Routing, data retrieval, validation
Inertia::render()
Pass data from the controller to a Vue component
Vue page component
Receive props and render the UI
useForm
Form state management, submission, error display
Link component
Client-side navigation without full reloads
usePage().props
Access shared data from any component
With Inertia × Vue you get the simplicity of Laravel’s backend and the reactivity of Vue’s UI in one cohesive stack. Run laravel new and pick Vue to get authentication pages and the full setup out of the box.
Inertia.js Documentation
See the official Inertia v3 docs for the full feature reference.