1.1.0 • Published 3 years ago

inertiajs-formkit-plugin v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

InertiaJS Formkit Plugin

A plugin for integrating FormKit and InertiaJS.

Installation

npm i inertiajs-formkit-plugin
import inertiaFormkitPlugin from 'inertiajs-formkit-plugin'

// formkit.config.js
const config = {
    plugins: [inertiaFormkitPlugin]
}

Usages

This plugins uses the inertia callback functions to add to the formkit node the states like loading and disabled.

<FormKit
    type="form"
    submit-label="Login"
    // Now when you call inertia visit passing the new inertiaOptions it adds to formkit node the states like loading and disabled
    @submit="(fields, _, inertiaOptions) => $inertia.post($route('yourRouter'), fields, inertiaOptions)"
>
    <FormKit type="email" name="email" label="E-mail" />
    <FormKit type="password" name="password" label="Password" />
</FormKit>

Functionalities

  • Loading state when submiting
  • Disabled state when submiting
  • Progress percentage added to the state
  • Cancel visits function via schema and node
  • Set and remove backend validation errors automaticaly

Improvements

  • Add formkit typescript types to the plugin parameter
  • Make sure that only that formkit node is changed when inertia makes a visit
  • Remove inertia event when the node is also removed

Changelog

You can check any version change and its commits by the changelog

1.1.0

3 years ago

1.0.0

3 years ago