Socket
Book a DemoInstallSign in
Socket

formkit-inertify

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

formkit-inertify

A plugin for integrating InertiaJS with FormKit

latest
Source
npmnpm
Version
2.0.0-alpha.5
Version published
Maintainers
1
Created
Source

FormKit Inertify

A plugin for integrating InertiaJS with FormKit.

Installation

npm i formkit-inertify
import formkitInertify from 'formkit-inertify';

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

How to use

This plugins adds to formkit's context an inertia property to be used for visits adding visit callbacks to change formkit's state.

<!-- You can use the new inertia property inside the context to make inertia visits -->
<FormKit
    type="form"
    submit-label="Login"
    @submit="(fields, node) => node.context.inertia.post('/login', fields)"
>
    <FormKit type="email" name="email" label="E-mail" />
    <FormKit type="password" name="password" label="Password" />
</FormKit>

Inertia options

You can pass any of inertia options to it, event callbacks also get the node as the second parameter as a bonus.

<!-- You can pass any inertia property and events callback to it -->
<FormKit
    type="form"
    submit-label="Login"
    @submit="(fields, node) => node.context.inertia.post('/login', fields, { onBefore: (visit, node) => { console.log(visit, node); }})"
>
    <FormKit type="email" name="email" label="E-mail" />
    <FormKit type="password" name="password" label="Password" />
</FormKit>

Disable inertify behaviour

If you want to disable the default behaviour of inertify at a given event you can by setting its disable callback name to false.

<FormKit
    type="form"
    submit-label="Login"
    @submit="(fields, node) => node.context.inertia.post('/login', fields, { onBefore: (visit, node) => { console.log(visit, node); }, disable: { onError: false } })"
>
    <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
  • Set and remove backend validation errors automaticaly

Changelog

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

Contributing

Any contribution is welcomed, be it an issue found, a feature you would like to see, to any pull request you wish to make.

[ Checkout how to do it ]

Keywords

inertia

FAQs

Package last updated on 31 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts