@javaabu/forms is the React version of javaabu/forms, the Laravel Blade form components. It has the same components and attributes, model binding, old input and validation errors, so a form looks and behaves the same in a Blade view and an Inertia React page. It renders with Onu, shadcn/ui, plain HTML or your own UI kit.
<x-forms::form :model="$article" method="PATCH" :action="route('articles.update', $article)">
<x-forms::text name="title" required />
<x-forms::select2 name="category" :options="$categories" relation />
<x-forms::checkbox name="is_featured" />
<x-forms::submit>Save</x-forms::submit>
</x-forms::form>import { Checkbox, Form, Select2, Submit, Text } from "@javaabu/forms"
import { update } from "@/actions/App/Http/Controllers/ArticlesController"
;<Form model={article} action={update}>
<Text name="title" required thaana />
<Select2 name="category" options={categories} relation />
<Checkbox name="is_featured" />
<Submit>Save</Submit>
</Form>- The Blade API. The same component names, camelCase attributes, generated ids and translated labels.
- Laravel built in. Model binding, old input, method spoofing, CSRF, relations,
sync_fields, and validation errors under the right field, including error bags anditems.0.namekeys. - Any UI. Adapters for Onu, shadcn/ui and plain HTML, a typed adapter contract with a conformance test kit, and per-component overrides.
- Inertia and Wayfinder. Forms submit as Inertia visits, or through
useForm(), without glue code, and take Wayfinder routes asaction. They also submit natively or with fetch. - Dhivehi and RTL. English and Dhivehi strings with @javaabu/i18n, RTL layouts and Thaana typing.
npm install @javaabu/formsimport { FormsProvider } from "@javaabu/forms"
import { inertia } from "@javaabu/forms/inertia"
import { onu } from "@javaabu/forms/onu"
;<FormsProvider ui={onu} router={inertia}>
{children}
</FormsProvider>Without a bundler, load the <script> tag build. It puts the components on window.JavaabuForms, with React bundled in:
<script src="https://unpkg.com/@javaabu/forms/dist/forms.iife.js"></script>
<script>
const { h, mount, Form, Text, Submit } = JavaabuForms
mount("#app", h(Form, { action: "/users" }, h(Text, { name: "name" }), h(Submit)))
</script>The full documentation is in docs/, with an index for AI assistants in llms.txt. Start with:
- Installation and setup
- Forms and buttons, model binding, validation errors
- UI adapters, shadcn/ui, Inertia, Wayfinder
- Migrating from Blade, upgrading from @javaabu/react-forms, parity with javaabu/forms
pnpm install
pnpm examples # one page per adapter (add ?dv for Dhivehi)
pnpm check # lint, format, typecheck, tests, build, examplesThe MIT License (MIT). Please see License File for more information.