Skip to content

Form Components

For the simple usage with schema and data values FormKitDataEdit and FormKitDataView (and FormkitDebug) components are available.

Usage

To use the components there must be an import or global registration.

vue
    <FormKitDataEdit v-model="formData" :schema="formSchema"
                     @data-saved="submitHandler"
/>

Debug

Use properties :debug-schema="true" and / or :debug-data="true" for debugging of schema / data.

FormKitDataEdit

Main Properties

PropertyTypeDescription
v-modelObjectThe data object to be edited with 2-Way-Binding
dataObjectThe data object to be edited
:schemaObjectThe schema object to be used
:debug-schemaBooleanDisplay the schema
:debug-dataBooleanDisplay the data
:show-resetBooleanDisplay some Button for resetting data to initial state

Style Properties

PropertyTypeDescription
formClassStringAdd additional classes to the form
actionsClassStringAdd additional classes to the action div
submitClassStringAdd additional classes to the submit button
submitSeverityStringPrimeVue Button severity
submitLabelStringDefault: Save
submitIconStringPrimeVue Button icon
resetClassStringAdd additional classes to the reset button
resetSeverityStringPrimeVue Button severity
resetLabelStringDefault: Reset
resetIconStringPrimeVue Button icon

Example

vue
<script setup lang='ts'>
import { FormKitDataEdit } from '@sfxcode/formkit-primevue/components'

const formSchema = ref({}) // some schema should be provided
const formData = ref({}) // some data

async function submitHandler(data: any) {
  // some action on form submit
}
</script>

<template>
  <div>
    <FormKitDataEdit
      v-model="formData" :schema="formSchema"
      :debug-schema="false" :debug-data="true"
      @data-saved="submitHandler"
    />
  </div>
</template>

FormKitDataView

Same as FormKitDataEdit but without Action Buttons.

FormKit PrimeVue Module