Dynamic grids in panel?

Hey there,

I’m asking for a solution to the following problem. Maybe someone already solved it.

I got sections on my page which I want to reuse with different content types. For example I got a divider / banner where I want to be able to have something like testimonials in there:

For the testimonials I would need 3 column-4’s but I want to reuse that same banner element to be used to embed a video in the center with maybe a column-12 (or col-8 with offset-2) without having to create an extra element.

I don’t want my client to chose from a huge pile of grid variations of the very same element like:

"Banner two column"
"Banner full width"
"Banner three column"
"Banner 2/3rd" 
...
"Content-block two column"
"Content-block 2/3rd"
....
.

I hope you get what I mean. Maybe its some kind of “don’t repeat yourself” for elements :slight_smile:

So I would need dynamic grid sizes which can be chosen from the kirby panel. You would then choose “element banner” and select how many columns you need. For those columns you would then select which kind of content element (video / text / etc) you want.

Is something like that possible?

Greetings

There are two plugins that might help with this, which you might want to combine:

The builder plugin is an extended structure field; you can predefine different sorts of elements, e.g. a video banner, a testimonials banner etc.

I’d use a structure field for this. Then the client can create as many items as they need columns and the number of columns can then be detected automatically from the number of structure items. You can set the classes based on that information.

Thats a good idea @lukasbestle. I already used the builder plugin but never thought of using the number of columns to define how many grid columns I would need. Have to see If that will work out.

[…] you can predefine different sorts of elements, e.g. a video banner, a testimonials banner etc.

@texnixe but than you will also have all kind of different variations of the same element. That’s what I wanted to avoid.

Still just working on the frontend and design and had this random thought during the process. I might come back to that thread when I am starting with implementing the site :slight_smile:

Not sure if this is what you want;

But I used dynamic grids in the panel, for a table-builder.

Maybe it can be a starting-point.