On-page navigation with blocks

Hi,

I have a page builder setup with various blocks the user can choose from. What is the best way of assigning/exposing id’s for these so they can be linked to using the anchor option in the link field?

I could have a simple text box in each block but then would need to somehow check that these were all unique (or just warn the user they needed to be). In an ideal world I would use the block id assigned by Kirby but I can’t work out a way to display that as part of the block preview for the user.

Has anyone done this before with blocks?

Sorry, i missed the part that you want to display the ID in the panel.

No problem! I just want to make it as easy as possible for the user to link to individual blocks using anchors.

You can access the block id with this.id

  blocks: {
      exampleblock: `
        <div @click="open">
          {{ this.id }}
        </div>
      `,
    }

Note that you would have to change all block previews to include the id somewhere