How can I add additional fields to a files field that is used within a block?

I’m a new Kirby user and I’m trying to create a block for an image gallery where each image can have a size (default or large).

This is the blueprint I’m working with:

# site/blueprints/blocks/gallery.yml
title: Galerie
preview: fields
wysiwyg: true
label: "{{ title }}"
icon: grid
tabs:
  content:
    label: Inhalt
    fields:
      headline:
        label: Titel
        type: text
      images:
        label: Bilder
        type: files
        layout: cards
        fields:
          alt:
            label: Alt-Text
            type: text
          caption:
            label: Bildunterschrift
            type: text

  settings:
    extends: tabs/block-settings

As you can see, I’ve tried adding “fields” to the “images” field but the fields aren’t showing up in the panel.

I’ve also read about Files blueprints but they seem to apply only for entire sections of a page.

I feel like I have some concept wrong, can somebody point me in the right direction?

Thanks for your help!

No, you can assign a file blueprint to any entity that allows uploading files: files section, files field or textarea.

And a file blueprint is the only way to assign fields to a file.

For a files field (which you are using here), a file template is assigned via the uploads property, see Files | Kirby CMS.

Thank you very much, that worked!

I added the following file:

# site/blueprints/files/gallery-files.yml

title: Galeriebild
create:
  width: 2000
  height: 2000
fields:
  alt:
    label:
      de: Alt-Text
      en: Alt text
    type: text
  thumbnailSize:
    label: Größe
    type: select
    default: default
    options:
      default: Default
      lg: Large

And adjusted my block blueprint like so:

tabs:
  content:
    label: Inhalt
    fields:
      headline:
        label: Titel
        type: text
      images:
        query: page.images.filterBy('template', 'gallery-files')
        label: Bilder
        type: files
        layout: cards
        info: "{{ file.thumbnailSize }}"
        uploads:
          template: gallery-files            # <- Added this