Skip to content

Component Props

API reference for the SchemaForm component props.

SchemaForm Props

The component returned by createSchemaForm(adapter) accepts the following props:

PropTypeDefaultDescription
modelValueFormData{}Form data object (two-way binding via v-model)
schemaSchemaRaw{}The form schema definition
depsRecord<string, any>{}External dependencies accessible in expressions as $deps
readonlybooleanfalseSets all fields to read-only
disabledbooleanfalseDisables all fields
removeHiddenDatabooleanfalseWhen true, getFormData() excludes hidden fields
debugbooleanfalseLogs form data and schema changes to the console (dev only)
displayType'row' | 'column''row'Default layout direction for label and input
borderbooleantrueWhether fields show borders by default
inlineErrorMessagebooleanfalseWhen true, error messages are handled inline by widgets instead of the form-level error state
validatorValidatorAdapterundefinedCustom validator to replace the built-in validation engine

Events

EventPayloadDescription
update:modelValueFormDataEmitted when form data changes

Usage

vue
<template>
  <SchemaForm
    v-model="formData"
    :schema="schema"
    :deps="{ maxItems: 10 }"
    :disabled="isSubmitting"
    :readonly="false"
    :remove-hidden-data="true"
    :debug="isDev"
    display-type="row"
    :border="true"
    :validator="customValidator"
  />
</template>

TypeScript Types

ts
import type { FormData, SchemaRaw, Deps, ValidatorAdapter } from '@v3sf/core'

FormData

ts
type FormData = Record<string, any>

Deps

ts
type Deps = Record<string, any>

ValidatorAdapter

ts
interface ValidatorAdapter {
  validate: (value: any, rules: ValidatorRule[], fieldSchema: Schema) => Promise<string[]>
}

Prop Inheritance

Some props can be overridden at the field level in the schema:

Component PropSchema Field PropertyBehavior
disableddisabledField-level value takes precedence
readonlyreadonlyField-level value takes precedence
borderborderField-level value takes precedence
displayTypedisplayTypeField-level value takes precedence

Released under the MIT License.