Skip to content

useFieldProps 2.0.0+

Returns the props used by all field components

Usage

vue
<script setup>
import { toRefs } from 'vue'
import { useFieldProps } from '@kevinkosterr/vue3-form-generator'
  
const props = defineProps(useFieldProps())
  
const { field, model } = toRefs(props)
</script>

Props

id String

Id of the field, computed based on the idPrefix set within the FormGenerator component and name property of the field.

formOptions Object

An object of global options for the current form.

field Object required

Field object as set in the schema.

model Object required

Model object as set in the schema, contains all current values.