Use the Inertia Form component in Vue

The Inertia Form component posts the fields and exposes errors. Wayfinder can supply the action.

For your AI agent

Copies a prompt. Paste it into the AI agent you already have open.

Read https://laravel-vuejs.space/inertia-form-component-vue.md
The Inertia Form component posts the fields and exposes errors. Wayfinder can supply the action.
Do not install Vue Router so this form can "have a route".
Show the diff. Do not commit.
On this page · 3 sections
  1. The fix
  2. What to avoid
  3. FAQ

People searching “Inertia Form component Vue” want the form that ships with @inertiajs/vue3, not a third-party form library. The Wayfinder guide passes a generated action into it. The file upload guide uses the same component for a file. This page is the error slot.

TL;DR

  • The Inertia Form component posts the fields and exposes errors.
  • Wayfinder can supply the action.
  • Do not install Vue Router so this form can “have a route”.

Who it's for: Laravel + Vue developers on Inertia

Applies to: Laravel 13 · Inertia 3 · Vue 3

The fix#

vue
<script setup lang="ts">
import { Form } from "@inertiajs/vue3";
</script>

<template>
  <Form action="/posts" method="post" v-slot="{ errors, processing }">
    <input name="title" />
    <p v-if="errors.title">{{ errors.title }}</p>
    <button type="submit" :disabled="processing">Save</button>
  </Form>
</template>

Fields need a name. The component submits those names. A v-model without a name is not sent. errors.title matches the Laravel rule key, the same way form.errors.title does with useForm.

When the action comes from Wayfinder, drop method="post" and use :action="store()". The generated object already carries the method. Adding both is how a GET form gets posted twice in tutorials that mix the two styles.

What to avoid#

Gotcha

Do not install Vue Router so this form can “have a route”. The route is the Laravel URL in action.

FAQ#

How do I use the Inertia Form component in Vue?

The Inertia Form component posts the fields and exposes errors. Wayfinder can supply the action.

What goes wrong with Inertia Form component Vue?

Many developers want the form that ships with @inertiajs/vue3, not a third-party form library. Do not install Vue Router so this form can "have a route".

Found this useful?

Ask questions, share what you built.

Join thousands of Laravel and Vue developers in our Facebook group, or get new posts in your Telegram feed. Sharing this article helps too.

Keep reading

Newsletter

Get the best of Laravel & Vue, once a month.

One short email with new guides, release notes worth reading and hand-picked community links. No spam, unsubscribe any time.