npx ui-thing@latest add vee-form-builder
Now you can use the form builder component in your project.
<template>
<FormBuilder :fields="fields" />
</template>
<script lang="ts" setup>
import type { FormBuilder } from "@/components/Ui/FormBuilder/FormBuilder.vue";
const form: FormBuilder[] = [
{
variant: "Checkbox",
name: "rememberMe",
label: "Remember Me",
description: "Remember me on this device",
},
];
</script>
Here is an example of the component in action.
Do note that you can use the renderIf
prop to conditionally render a field.
Also, you can render your own markup by using the name
of the prop on the object as the slot name. This is demonstrated in the Conditional & Currency
section of the form.