@formkit/addons

Introduction

Common, optional, first-party add on features for FormKit.

You can add this package by using npm install @formkit/addons or yarn add @formkit/addons.

Functions

createAutoAnimatePlugin()

Adds auto-animate to each input automatically:

Signature

createAutoAnimatePlugin(options?: AutoAnimateOptions, animationTargets?: Record<string, string[]>): FormKitPlugin;

Parameters

  • options optionalAutoAnimateOptions
  • animationTargets optional — A map of input types and an array of their sections that should be animated.

Returns

FormKitPlugin

Examples

import { createApp } from 'vue'
import App from 'App.vue'
import { createAutoAnimatePlugin } from '@formkit/addons'
import { plugin, defaultConfig } from '@formkit/vue'

createApp(app).use(plugin, defaultPlugin({
  plugins: [
    createAutoAnimatePlugin({
      // optional config
      duration: 250,
      easing: 'ease-in-out',
      delay: 0,
    },
    {
      // optional animation targets object
      global: ['outer', 'inner'],
      form: ['form'],
      repeater: ['items'],
    })
  ]
}))

createAutoHeightTextareaPlugin()

Creates a new auto-height textarea plugin.

Signature

createAutoHeightTextareaPlugin(): FormKitPlugin;

Returns

A FormKitPlugin

createFloatingLabelsPlugin()

Creates a new floating label plugin.

Signature

createFloatingLabelsPlugin(FloatingLabelsOptions?: FloatingLabelsOptions): FormKitPlugin;

Parameters

Returns

A FormKitPlugin

createLocalStoragePlugin()

Creates a new save-to-local-storage plugin.

Signature

createLocalStoragePlugin(localStorageOptions?: LocalStorageOptions): FormKitPlugin;

Parameters

  • localStorageOptions optional

Returns

A FormKitPlugin

createMultiStepPlugin()

Creates a new multi-step plugin.

Signature

createMultiStepPlugin(options?: MultiStepOptions): FormKitPlugin;

Parameters

Returns

A FormKitPlugin

TypeScript

FloatingLabelsOptions

The options to be passed to createFloatingLabelsPlugin

interface FloatingLabelsOptions {
    useAsDefault?: boolean;
}

LocalStorageOptions

The options to be passed to createLocalStoragePlugin

interface LocalStorageOptions {
    beforeLoad?: (payload: any) => any;
    beforeSave?: (payload: any) => any;
    control?: string;
    debounce?: number;
    key?: string | number;
    maxAge?: number;
    prefix?: string;
}

MultiStepOptions

The options to be passed to createMultiStepPlugin

interface MultiStepOptions {
    allowIncomplete?: boolean;
    hideProgressLabels?: boolean;
    tabStyle?:'tab' | 'progress';
}