A plugin for integrating InertiaJS with FormKit.
npm install formkit-addon-inertiaPlugin for integrating InertiaJS with FormKit
You can check out the full documentation here
There are two ways to use this addon, firstly there is the composable way, and there is also a formkit plugin.
> In the end, the plugin uses the composable inside of it with the correct form node for easy of use.
``bash`
npm i formkit-addon-inertia
The useInertia is a function that receives a FormKit node and returns all Inertia HTTP methods.visit
Those are , get, post, put, patch, delete and reload.
`html
@submit="(fields, node) => useInertia(node).post('/user', fields)"
>
`
The inertia context property has all Inertia HTTP methods.visit
Those are , get, post, put, patch, delete and reload.
`html
:plugins="[inertiaPlugin]"
@submit="(fields, node) => node.context.inertia.post('/user', fields)"
>
`
> You can add this plugin as a global formkit plugin so every form has it, instead of defining manually like the example above
>
> `js``
> import { createApp } from "vue";
> import App from "App.vue";
> import { plugin, defaultConfig } from "@formkit/vue";
> import { plugin as inertiaPlugin } from "formkit-addon-inertia";
>
> createApp(App)
> .use(plugin, defaultConfig({ plugins: [inertiaPlugin] }))
> .mount("#app");
>