Can I create a table field in the panel?


Is it possible to create a table field in the panel (to manage business hours for exemple)?

Thank you.

The best way to do that would be via a structure field. Then you can create the table in your template.

As an alternative, you can use a standard textarea field and create a table in markdown. You have to enable markdown extra first in your config.php to be able to do that.

But the structure field way of doing that is much more versatile.

1 Like

Awesome! I’ll try this out. However, I think the markdown approach is not super intuitive for non-technical end users, but thanks for the suggestion!

hi @_jpalbert

yesterday i made a simple
3-col table like this.


    label: Table head col 1
    type:  text
    width: 1/3
    label: Table head col 2
    type:  text
    width: 1/3
    label: Table head col 3
    type:  text
    width: 1/3
    label: 3-Col table body
    type: structure
    style: table
    entry: >
      {{table-col-1}}<br />
      {{table-col-2}}<br />
        label: Table body col 1
        type: text
        label: Table body col 2
        type: text
        label: Table body col 3
        type: text


<?php if ($page->threecoltablebody()->isNotEmpty()): ?>


    <?php if ($page->threeColTableHeadOne()->isNotEmpty()): ?>
          <th><?php echo $page->threeColTableHeadOne()->html() ?></th>
          <th><?php echo $page->threeColTableHeadTwo()->html() ?></th>
          <th><?php echo $page->threeColTableHeadThree()->html() ?></th>
    <?php endif ?>

      <?php foreach($page->threecoltablebody()->toStructure() as $tableBodyItem): ?>
          <td data-label="<?php echo $page->threeColTableHeadOne()->html() ?>"><?php echo $tableBodyItem->table_col_1() ?></td>
          <td data-label="<?php echo $page->threeColTableHeadTwo()->html() ?>"><?php echo $tableBodyItem->table_col_2() ?></td>
          <td data-label="<?php echo $page->threeColTableHeadThree()->html() ?>"><?php echo $tableBodyItem->table_col_3() ?></td>
      <?php endforeach ?>


<?php endif ?>



for a table with an unknown count of table columns
i don’t have a simple solution yet… :wink:

saludos, funkybrotha

Please help to improve code readability by wrapping code blocks within three backticks at the beginning and the end of a block on a separate line. I have corrected your code above. To see how it works, click on the pencil icon of your post. Thank you.

good morning @texnixe!

aha… ok, i see
the preformatted text function
just makes one…

thanx a lot! :wink:

saludos, funkybrotha

1 Like

maybe you can alsow draw inspration from here and creeate your own field

that plugin is using

Maybe it could help :

It’s not perfect, because a lot verbose, but I tried to make it so it will be easier to user to makes table than with the markdown syntaxt, wich is great in Text editor but not really in a textarea fiel…

my problem with the kirby-plugin-table is that you need to have a blank line before and after the ++++ and ////. that made the texte endless long.
but maybe this changed with new syntax (…column…) and (…row…)?

I probably can manage to not take care of line blank before and after… Maybe it already work without, I need to review the code to answer that.

But, anyway, it will be long. It’s more for table with just few cells and long datas than huge table with short values…

just checked again. v 1.1.0 of tableplugin still need blank lines after (…CMD…).