Forms in PHP
Fields, fieldsets, the submit route, and validation live together in a form class you can reuse and test.
Define fields, layout and validation in one Laravel class. Render it in Vue, React or Svelte with a single component, with custom pickers, conditional fields and server validation built in.
erag/inertia-formscomposerWorks with Laravel 13 Inertia 3 Vue 3.5 React 19 Svelte 5 Tailwind CSS 4
These forms come from PHP classes and render with the Vue component. Switch forms, change the accent color, and submit to see the data.
Stop repeating labels, inputs, rules, and error handling in two places. One PHP class drives the page and the validation.
Fields, fieldsets, the submit route, and validation live together in a form class you can reuse and test.
Render the whole form with <Form>. The same PHP class works with Vue, React, and Svelte packages.
required(), email(), options, and file types become Laravel rules. Validate with #[Validate].
Show fields based on other values. Hidden fields are skipped by validation, so the browser and server agree.
Remove fields, fieldsets, or a whole form for users who should not see them. Their rules disappear too.
Fill edit forms from an Eloquent model or array, including nested paths, dates, enums, and booleans.
Drag and drop, image previews, size and type rules. Update forms with files are sent the way Laravel expects.
Group fields with legends and descriptions, lay them out in columns, and span wide fields across the row.
One dropdown for single and multiple values, with local search or options loaded from the server, fed by arrays, collections, or enums.
Clean Tailwind CSS 4 classes with dark mode. Add your own classes to fields, fieldsets, and the form.
Add a PHP field class and register its Vue, React, or Svelte component. It gets labels, errors, and layout for free.
Labels, aria attributes, keyboard support, and focus moves to the first error after a failed submit.
The package ships Laravel Boost guidelines and a skill. After php artisan boost:install, your agent knows the form class, so “an edit profile form with an avatar” comes back as one PHP class, not a page of inputs, state and error handling.
A form is a short list of fields. That is less for an agent to write and less for you to review, and validation comes with it.
Every page has a Markdown version and llms.txt lists them all, so agents read the real API instead of guessing.
Laravel BoostClaude CodeCursorCodexGemini CLIGitHub Copilot
Visibility rules, dates and times, the combobox search, wizard steps, file handling and every Tailwind class live in one TypeScript core. The Vue, React and Svelte packages are thin renderers on top of it, so a form behaves the same in each.
Nothing underneath. Every control is ours.
Inertia Forms is free and open source. Sponsors keep it maintained, documented and growing.
Production-ready, multi-tenant starter kits for Laravel 13 and Inertia 3, in Vue, React or Svelte. Tenancy, sign-in with passkeys and two-factor, roles, translations and an admin dashboard come ready, so you start on your own product on day one.
You describe the form once. Laravel turns it into a JSON schema for the page, the frontend renders it, and the same class validates the submission.
Run php artisan make:form and list your fields, fieldsets, and route.
Send CreateUserForm::make() as an Inertia prop and render it with <Form>.
Type-hint the form with #[Validate] and use $form->validated().
Laravel Inertia Forms is an open-source package for building forms in Laravel and Inertia.js applications. Instead of writing the same labels, inputs, validation rules, and error messages in a controller and again in a Vue, React, or Svelte page, you describe the form once in a PHP class. The package serializes that class into a schema, renders it with one component styled with Tailwind CSS 4, handles conditional fields and file uploads, and validates the request with the same rules on the server.
Common questions about Laravel Inertia Forms, validation, frontends, and customization.
Laravel 13 with Inertia 3 and PHP 8.3+. On the frontend, pick the package for your stack: @erag/inertia-forms-vue (Vue 3.5+), @erag/inertia-forms-react (React 19), or @erag/inertia-forms-svelte (Svelte 5). Styling uses Tailwind CSS 4.
Most rules are generated from the field setup, like required(), email(), maxLength(), option lists, and file types. Add anything else with ->rule() or ->rules(), for example unique:users,email. Validate with the #[Validate] attribute or $form->validate($request).
They are removed from the page in the browser and skipped during validation, so a hidden required field never blocks a submission and its value is left out of validated(). Add clearWhenHidden() to reset the value when the field disappears.
Yes. Call ->bind($model) to fill the form from an Eloquent model or an array, and point it at an update route with ->route('users.update', $user). The HTTP method is read from the route.
Create a PHP class that extends Field and returns a component name, then register a matching component on <Form> with the components prop. Your component receives the field, its value, and its error, and is wrapped with the label and help text automatically.
Yes. Every field, fieldset, and the form accept extra CSS classes, and dark mode follows Tailwind's dark: variant. Point Tailwind at the package with one @source line so its classes are generated.
Install the Laravel package and the frontend package for your stack:
composer require erag/inertia-formsnpm install @erag/inertia-forms-vueUse @erag/inertia-forms-react or @erag/inertia-forms-svelte for React or Svelte, then follow the Quick Start.