Automatically generates forms from a JSON schema and an optional UI schema.
This monorepo contains several packages that make up VueJsonForm:
The main Vue.js component for rendering JSON Schema-based forms.
A standalone web component wrapper for VueJsonForm. Use it in any HTML page without Vue.js.
JSON Schema definitions and TypeScript types for VueJsonForm. Contains the UI schema specification.
Ajv-based validator for VueJsonForm that validates the schemas passed as props.
Install the main package:
npm install @educorvi/vue-json-formBasic usage example:
<script setup lang="ts">
import { VueJsonForm } from '@educorvi/vue-json-form';
import '@educorvi/vue-json-form/dist/vue-json-form.css';
const jsonSchema = {
type: 'object',
properties: {
name: { type: 'string' },
email: { type: 'string', format: 'email' }
},
required: ['name', 'email']
};
const uiSchema = {
type: 'VerticalLayout',
elements: [
{ type: 'Control', scope: '#/properties/name' },
{ type: 'Control', scope: '#/properties/email' }
]
};
function handleSubmit(data: Record<string, any>) {
console.log('Form submitted:', data);
}
</script>
<template>
<vue-json-form
:jsonSchema="jsonSchema"
:uiSchema="uiSchema"
:onSubmitForm="handleSubmit"
/>
</template>Note: Bootstrap 5 is required. See the full documentation for detailed setup instructions.
yarn installyarn run buildyarn run docRequires Python package json-schema-for-humans.
MIT