Skip to main content

What is Vue.js?

Vue.js (Vue for short) is a progressive JavaScript framework for building user interfaces. “Progressive” means you can start small and add features as needed—it supports partial integration into an existing HTML page as well as building large SPAs. The core of Vue is reactivity. When data changes, the DOM updates automatically, so developers don’t have to manually manage “when to update which element.”
This page describes the combination of Vue 3 and Inertia v3. The Laravel 13 starter kit uses this stack by default.

Options API and Composition API

Vue 3 provides two component-writing styles: Options API and Composition API. Options API is the traditional style carried over from Vue 2. Define components with an options object containing data, methods, computed, mounted, etc.
Composition API is the newer style introduced in Vue 3. Combined with the <script setup> syntax, you can write more concisely. It offers better logic reuse and works well with TypeScript.
In Inertia × Laravel starter kits, <script setup> with the Composition API is the standard. All examples on this page use <script setup>.

Vue’s position in Laravel

History

Vue’s relationship with Laravel is long, starting when Vue was adopted as the default frontend framework in Laravel 5.3 (2016). At the time, package.json included Vue, and there was a sample resources/js/components/ExampleComponent.vue component. In Laravel 6 (2019), authentication scaffolding was split into the laravel/ui package, and Vue scaffolding moved along with it. Today, the mainstream approach is to select the Inertia + Vue setup via the laravel new starter kit. Vue is the JS framework Laravel users are most familiar with, and Japanese learning resources are plentiful.

The current mainstream style: Inertia × Vue

The center of gravity for Vue in Laravel today is Inertia × Vue. Inertia enables a “modern monolith” architecture where data flows from Laravel controllers directly to Vue components without designing an API.

Setup

For new projects, using a starter kit is the easiest way.
Choosing Vue in the interactive prompt sets up all of the following automatically:
  • inertiajs/inertia-laravel (server-side adapter)
  • @inertiajs/vue3 (client adapter)
  • vue (Vue 3 itself)
  • @vitejs/plugin-vue (Vite plugin)
  • The HandleInertiaRequests middleware
  • Auth screens like login and registration (already implemented in Inertia + Vue)

Manual installation

To add it to an existing project, install the server-side and client-side pieces separately.
Next, add the Vue plugin to vite.config.js.
Start the Inertia app from resources/js/app.js.
For manual installation details (root template configuration, middleware registration, etc.), see the Inertia official docs.

Directory structure

In the starter kits, Vue page components live in the resources/js/pages/ directory.
Writing Inertia::render('Posts/Index', [...]) maps to the component at resources/js/pages/Posts/Index.vue.

Vue template syntax

Here are the basic template directives needed to read and write starter kit code.

{{ }} — variable interpolation

Double curly braces embed a JavaScript value or expression into the template.

v-if — conditionals

Equivalent to Svelte’s {#if} or React’s ternary operator.

v-for — list rendering

Always specify :key for efficient diffing. Corresponds to React’s Array.map().

v-model — two-way binding

Use v-model to two-way sync a form element’s value with a reactive variable.

: (v-bind) and @ (v-on)

  • :attr="value" — bind a dynamic value to an HTML attribute (shorthand for v-bind:attr)
  • @event="handler" — register an event listener (shorthand for v-on:event)

Page component basics

Inertia page components are ordinary Vue components. Data passed from a Laravel controller arrives as props.

Controller

Vue page component

Just declare props with defineProps() and use the data passed from the controller in the template. No REST API definition needed.
The <Link> component provided by @inertiajs/vue3 routes page transitions via XHR, avoiding a full browser reload.
You write it like a normal <a> tag, but Inertia swaps only the page component in the background, giving you an SPA-like feel.

The Form component

The <Form> component from @inertiajs/vue3 is the recommended form submission style used in the starter kit auth screens. Specify action and method as props, and access errors and processing via v-slot.

Basic usage

v-slot="{ errors, processing }" is Vue’s scoped slot syntax, and the Form component computes and provides these values automatically. Form fields use HTML-native name attributes rather than v-model, and the browser’s standard form data collection does the work.

Starter kit pattern

The starter kit uses Wayfinder to manage routes as objects. store.form() returns an object containing the route object’s action and method, which is spread onto <Form> with v-bind.
Fields listed in reset-on-success are automatically reset on successful submission. Use it for fields like password fields that should be cleared after submit.
Without Wayfinder, pass the URL directly like action="/login" and it behaves the same.

The useForm helper

For form handling, use @inertiajs/vue3’s useForm helper. It cleanly implements form state management, submission, and validation error display.

Controller side

Vue form component

Here are the main properties on the object returned by useForm. When validation errors are returned, useForm displays them while preserving the input values. Combined with v-model, it delivers a seamless form experience.

Shared data

Data needed on every page (the logged-in user, flash messages, etc.) is defined in the share() method of the HandleInertiaRequests middleware.
Use usePage() to access shared data from a Vue component.
Because shared data is included on every request, keep it to the minimum needed. Wrapping in fn() for lazy evaluation ensures it’s only evaluated when actually accessed.

Vue 3 reactivity basics

Here are the Vue 3 reactivity APIs to know when developing with Inertia × Vue.

ref — primitive reactive value

computed — computed property

onMounted — post-mount work


Summary

Vue.js has strong affinity with Laravel, and shines especially in a “modern monolith” configuration through Inertia. Inertia × Vue lets you enjoy both the simplicity of a Laravel backend and Vue’s reactive UI. Creating a project from the starter kit gets you started immediately, auth screens included.

Inertia.js official docs

See the official documentation for all Inertia v3 features.
Last modified on July 13, 2026