Skip to content

Kirby 6.0.0

Info

Static text, help and info boxes for your editors

Field options

Name Type Default Description
default mixed null Default value for the field, which will be used when a page/file/user is created
help arrayorstring null Optional help text below the field
icon string null Optional icon that will be shown at the end of the field
label arrayorstring no default value The field label can be set as string or associative array with translations
text arrayorstring null Text to be displayed
theme string null The design theme for the field
translate bool true Should the field be translatable?
when array null Conditions when the field will be shown
width string '1/1' The width of the field in the field grid. Available widths: 1/1, 1/2, 1/3, 1/4, 2/3, 3/4

The info field is for any kind of static text you want to place in a Panel layout: general information, help, warnings and other guidance for your editors. It stores nothing in the content file.

Example

title: Gallery

fields:
  info:
    type: info
    label: Info
    text: |
      Please double-check the licenses and sources
      of all images before you upload them to the gallery.

Shortcuts

For a field that is only used once per blueprint, you can use a shortcut. In its most basic form, an info field consists of the field type as name and the text property:

fields:
  info:
    text: Some text

Keep in mind that the same field name can only be used once per blueprint.

Label

The label is displayed above the text. Pass a simple headline as a string, or provide translations for multiple languages if you have an international editing team.

Single language

label: This is some very important information

Multiple languages

label:
  en: Attention
  de: Achtung
  es: Attencion

Placeholders

You can inject information from the current page into the label with template placeholders, using our query language:

label: "{{ page.title }} Information"

Text

The text can be a simple string, Markdown, KirbyText or HTML. Like the label, it can be translated, and it can query content from elsewhere.

Single language

text: Info

Multiple languages

text:
  en: This is some very important information
  de: Das ist eine wichtige Mitteilung

Multi-line text

For multi-line text with paragraphs, use the YAML block syntax:

text: |
  Dear Edith,

  this is some multi line text with paragraphs.

  Cheers,
  A. Dmin

Using KirbyText

In addition to Markdown, you can use KirbyText in your text, even including images:

info:
  text: "Check out the (link: help text: help pages) for details"

Text queries

text: "{{ kirby.page('somepage').text.kt }}"
text: "{{ site.index.count }}"
text: "{{ site.index.images.count }}"

Themes

By default the field is displayed as a blue info box. Switch the theme with the theme option to match the importance or meaning of the information.

The following themes are available:

  • info (default)
  • positive
  • negative
  • notice
  • warning
  • passive
  • text
  • dark
  • code
  • empty

negative

title: Gallery

fields:
  info:
    type: info
    label: Attention
    theme: negative
    text: |
      Please double-check the licenses and sources
      of all images before you upload them to the gallery.

positive

title: Gallery

fields:
  info:
    type: info
    label: Wohooww
    theme: positive
    text: |
      Just upload whatever you want. We get sued anyway.

Disable theming

You can disable the infobox theme entirely to show neutral text:

fields:
  info:
    type: info
    label: Info
    theme: none
    text: |
      This is a very neutral message

Conditional display

Like any other field, a list can be shown or hidden based on the value of another field. Set the condition with the when option, using a field name as the key and the value it has to have.

In the following example, each field is shown based on a different value of the postType field:

fields:
  postType:
    type: select
    options:
      - Gallery
      - Image
      - Text
  gallery:
    type: filelist
    template: gallery-image
    layout: cards
    size: tiny
    when:
      postType: Gallery
  image:
    type: filelist
    template: single-image
    max: 1
    layout: cards
    when:
      postType: Image
  text:
    type: textarea
    when:
      postType: Text
  tags:
    type: tags
    when:
      postType: Text

See conditional fields for the full set of rules.