UNPKG

@inkline/inkline

Version:

Inkline is the intuitive UI Components library that gives you a developer-friendly foundation for building high-quality, accessible, and customizable Vue.js 3 Design Systems.

15 lines (14 loc) 420 B
import { computed, ref } from "vue"; import { createSchema, serializeSchema, validateSchema } from "@inkline/inkline/validation"; export function useForm(formSchema) { const schema = ref(createSchema(formSchema)); const form = computed(() => serializeSchema(schema.value)); async function validate() { schema.value = await validateSchema(schema.value); } return { form, schema, validate }; }