Configure the (+) Add button in k-structure-field

I just playing arround with the Kirby UI Kit and stumbled upon the k-structure-field.

Given

<k-structure-field
    v-model="value"
    :required="true"
    label="Structure"
    name="structure"
    help="This is a structure field"
    @input="input"
/>

Result

How the heck do I configure the (+) Add Button to open a dialog? if I click the Button I get can't convert undefined to object error.

Also if I add :fields like and click an the empty state

 <k-structure-field
      v-model="value"
      :required="true"
      :fields="{
        name: {
            label: 'Name',
            type: 'text'
        }
      }"
      label="Structure"
      name="structure"
      help="This is a structure field"
      @input="input"
    />

I get an t.endpoints is undefined error.

As a side note this view is renderd in a custom panel plugin.

1 Like

Same for me, I’m totally stuck to use it…
The documentation seems to be incomplete for this field even if another has kind of “action” events behavior…
https://getkirby.com/docs/reference/plugins/ui/list-item#events

<template>
  <k-list-item
    :options="[
      {icon: 'edit', text: 'Edit', click: 'edit'},
      {icon: 'trash', text: 'Delete', click: 'delete'}
    ]"
    @action="action"
  />
</template>

<script>
export default {
  methods: {
    action(type) {
      switch(type) {
        case 'edit':
          // edit the item here
          break;
        case 'delete':
          // delete the item here
          break;
      }
    }
  }
};
</script>