Vue 3 Vanilla renderers for JSON Forms
npm install @jsonforms/vue-vanilla_Complex Forms in the blink of an eye_
JSON Forms eliminates the tedious task of writing fully-featured forms by hand by leveraging the capabilities of JSON, JSON Schema and Javascript.
This is the JSON Forms Vue Vanilla renderers package which provides a HTML5-based renderer set for JSON Forms Vue.
See our JSON Forms Vue seed repository to get started as quickly as possible.
Install JSON Forms Core, Vue and Vue Vanilla Renderers
``bash`
npm i --save @jsonforms/core @jsonforms/vue @jsonforms/vue-vanilla
Also add the packages to the transpile dependencies in the vue.config.js file:
`js`
module.exports = {
transpileDependencies: [
'@jsonforms/core',
'@jsonforms/vue',
'@jsonforms/vue-vanilla',
],
};
Use the json-forms component for each form you want to render and hand over the renderer set.
`vue`
:schema="schema"
:uischema="uischema"
:renderers="renderers"
@change="onChange"
/>
By default the Vanilla Renderers don't apply any CSS at all.
For a quick start you can use @jsonforms/vue-vanilla/vanilla.css.
For more information on how JSON Forms can be configured, please see the README of @jsonforms/vue.
Each rendered HTML element specifies a CSS class which can be used to style it.
This process can also be customized so that each element declares user-specified CSS classes.
Therefore JSON Forms Vue Vanilla can be integrated with any CSS-only UI framework quite easily.
You can find the default CSS classes in defaultStyles.ts.
To render your own classes simply provide them as styles.
These styles replace the defaultStyles.
If you want to fall back to defaultStyles or combine them with your own classes you'll need to do so programmatically, e.g.:
``vue`
:schema="schema"
:uischema="uischema"
:renderers="renderers"
@change="onChange"
/>
You can also use specify styles in the ui schema via the options.styles property.defaultStyles
Attributes specified here override the respective or provided styles.defaultStyles
Attributes not specified here fall back to either the or provided styles.
`js``
{
"type": "Control",
"scope": "#/properties/name",
"options": {
"styles": {
"control": {
"root": "my-control-root"
}
}
}
}
The JSONForms project is licensed under the MIT License. See the LICENSE file for more information.
Our current roadmap is available here.
See our migration guide when updating JSON Forms.