Skip to content

UseJsonFormOptions ​

The options of useJsonForm.

Definition ​

  • UseJsonFormOptions
    • builder SchemaBuilder: optional, builds the schema and knows your own types and rules. Defaults to createSchemaBuilder()
    • components FieldComponents: optional, your component for each field type
    • layoutComponents LayoutComponents: optional, your component for each layout type
    • validate ValidationMode: optional, when a field is validated the first time, as in Formisch
    • revalidate Exclude<ValidationMode, 'initial'>: optional, when it is validated again, as in Formisch

Example ​

ts
const jsonForm = useJsonForm(definition, {
  // Your own types, rules, messages and extensions. Defaults to createSchemaBuilder().
  builder: createSchemaBuilder({ extensions: [affects()] }),
  // Your component for each field type.
  components,
  // Your component for each layout type.
  layoutComponents: { section: LayoutSection, row: LayoutRow },
  // When a field is validated the first time, and again after that, as in Formisch.
  validate: 'blur',
  revalidate: 'input',
})

Composables ​