Fields Preview in Kirby 4

Hello,
I’ve been trying to make sense of this docs page: Blocks | Kirby CMS

It states that I can simply add a preview: fields to a blueprint to make the fields of a block show up in the blocks field. What I don’t understand is: Do I add this to the blueprint for the block? Do I add it to the page blueprint where I want preview to show up? I tried both, nothing happened.

My Block-Blueprint also looks different from the example and I’m not sure I understand the example blueprint. The example nests tabs inside a blocks field (?!?), my guess is that in the example the custom block is defined inside the fieldset-property of the blocks-field. This lead me to assume the preview: fields property should be added to the page-blueprint? Anyways, no matter where I add it, nothing happens.

How can I use these quick and easy previews in Kirby 4?

Never mind, I figured out where to put the preview: fields option. I still think the docs are a bit confusing, they don’t specify where to put the option.

In case someone finds this hoping for answers, here is the beginning of my custom block’s blueprint:

name:
  de: Karte
  en: Card
icon: expand
preview: fields
tabs:
  …

I do have another question though: Can I limit the fields shown in the preview?

That is correct, as it has a blocks field example with a fieldset.

Custom blocks can be defined either

  • right in the fieldset of a bock
  • as separate block blueprint
1 Like

No, the preview will show all fields as laid out in the blueprint.

Otherwise you need a custom preview.

Ok, thanks for your help :pray:

I added a feature request: https://kirby.nolt.io/623

I don’t really think such a customized preview makes sense, after all, it would require basically a second blueprint just for the preview, as the layout of the fields might have to change completely if you leave out fields or tabs.

That’s what we have custom previews for. Just my 2ct.

I both agree and disagree. I think using YAML instead of Vue is much easier.