Hi,
I’ve created a button plugin. Now I’d like to align two or more buttons horizontally in my panel column/section.
What’s the best approach: fiddling with columns in blueprint or manual css(flex) styling.
Excerpt of my blueprint below as also a screenprint.
Thanks for any advice.
Thanks again for the fast response
This doesn’t do the trick. I’ve got 3 columns, probably the space is not enough for the buttons. When I scale back to 2 columns then it works.
I’ll try to figure out how to address this by css flexbox. I’ll post my findings if I succeed.
Again thanks a lot.
Ok, I’ve implemented a temporary solution which is very specific, until I find a more generic approach this will do.
Kirby is using the section name identifying the blueprints section as a css class (luckily). In this way I can use this to add some custom css to reposition the buttons. In this case I named my section: “buttonSection1”, this is the top class I use to re-arrange the buttons with flex-css. See results below.
Ideally I would like to use a more generic approach whereas I could align the fields/buttons by a property from within the blueprint button definition. Ore maybe create a custom section like a “toolbar” section and arrange things there… anyhow I have to dive into Vue and Kirby more…
.k-section-name-buttonSection1 .k-grid {
display: flex;
flex-wrap: nowrap;
justify-content: flex-start; /* Align items to the left */
}
.k-section-name-buttonSection1 .k-grid .k-column {
flex: 1 0 auto; /* Grow to fit content, no shrinking, initial size based on content */
max-width: 90px; /* Adjust this based on the expected width of your buttons */
margin-right: 10px; /* Reduce the space between buttons */
}
.k-section-name-buttonSection1 .k-grid .k-column:last-child {
margin-right: 0; /* Remove margin for the last column */
}
.k-section-name-buttonSection1 .k-grid .k-column .k-button {
min-width: 120px; /* Minimum width for buttons */
width: auto; /* Allow buttons to size based on content */
}
.k-section-name-buttonSection1 .k-grid .k-column .k-button .k-button-text {
text-overflow: clip;
white-space: nowrap;
}