Skip to content

DynamicForm

A fully schema-driven form engine. Renders any combination of input types, selects, date pickers, checklists, and file uploads from a FormSchema JSON definition. Powers Praxis's form builder.

Usage

vue
<script setup>
import { ref } from 'vue'
import { DynamicForm } from 'praxis-vue-ui'

const schema = {
  sections: [
    {
      title: 'Personal Info',
      fields: [
        { name: 'first_name', label: 'First Name', type: 'text', required: true },
        { name: 'last_name', label: 'Last Name', type: 'text', required: true },
        { name: 'dob', label: 'Date of Birth', type: 'date' },
      ]
    }
  ]
}

const formData = ref({})
</script>

<template>
  <DynamicForm
    :schema="schema"
    v-model="formData"
    @submit="onSubmit"
  />
</template>

Props

PropTypeDefaultDescription
schemarequiredFormSchemaThe form schema definition. Describes all sections and fields to render.
modelValueRecord<string, any>{}Current form data. Use with v-model.
disabledbooleanfalsePuts the entire form in read-only mode.
loadingbooleanfalseShows loading state on the submit button.

Emits

EventPayloadDescription
update:modelValueRecord<string, any>Emitted on any field change with the updated form data.
submitRecord<string, any>Emitted when the form is submitted and valid.

NOTE

DynamicForm is the most complex component in the library. See the schema type definitions in @/types/api/common for the full FormSchema interface.

Built with VitePress