Showing block field info as label

Hi all - I am using Kirby’s native blocks feature for the first time today and wondering how to show the content from a block as the label for said block. Please see below for an example of a simple FAQ page where each question and answer set is a block you can add. I’d like to show the question as the label for each block.

fields: faqs:
    label: FAQ's
    blocks:
    type: blocks
    fieldsets:
      faq:
        label: "{{ block.question }}"
        icon: question
        fields:
          question:
            type: writer
          answer:
            type: writer

Thanks!

You can just use {{ question }}. Since you are using a writer that will also return the html codes here though. You could possible create a fieldMethod to strip out the html tags with Html::decode($field) and then using {{ question.yourFieldMethod }} (haven’t tried that out though but I think it should work :upside_down_face:)

fields: faqs:
    label: FAQ's
    blocks:
    type: blocks
    fieldsets:
      faq:
        label: "{{ question }}"
        icon: question
        fields:
          question:
            type: writer
          answer:
            type: writer

Thanks a lot; hadn’t thought about the html! I prob should have said though, I’m looking to replace the actual block name (rendered as ‘k-block-name’; within the blocks the labels show as if they’re info and the block names are kinda the labels. In the example you’ve given the block still will always say ‘faq’ then the question next to that in the paler text that looks like info within a structured field (but rendered as ‘k-block-label’ in the DOM)

I don’t quite understand where you want this label to appear. Wouldn’t it make sense if you create a preview? So that it then looks like this: