Structure of fields prop in k-structure-field

I can’t figure out the structure of the fields object the ‘fields’ prop expects in the k-structure-field. I am a total newbie to Vue, but the documentation could use an example, as it has for other fields.

<template>
  <k-structure-field
    :label="label"
    fields="{
      material: {
        label: 'Material',
        type: 'text',
        required: true
      },
    }"
  />
</template>

<script>
  export default {
    props: {
      label: String,
    },
}
</script>

The above returns an Cannot create property 'section' on string '{' error.

Isn’t the k-structure-field fields prop supposed to work like for example, the k-fieldset or k-form same named prop?

The structure field is pretty complex and very hard to extend to be honest. It heavily relies on its own API endpoints and needs an endpoints object. You would need to make sure to pass this all correctly to the k-structure-field component to make it work and also implement the structure field API endpoints in your plugin. I’m sorry that we don’t have good docs for this.

1 Like