Not adding columns to the grid via fill or fit.
Incrementing/decrementing the grid-template-columns repeat() integer when <app-panel>s are dynamically added/removed to/from the DOM.
Something like this...
CSS:
:root {
--columns: column-sum;
}
app-container {
display: grid;
grid-template-columns: repeat(var(--columns), minmax(100px, 1fr));
/* other styles... */
}
app-column {
counter-increment: column-sum;
/* other styles... */
}
HTML: (custom tags)
<app-container>
<app-column></app-column>
<app-column></app-column>
<app-column></app-column>
<app-column></app-column>
</app-container>
Rendered output should read:
app-container {
display: grid;
grid-template-columns: repeat(4, minmax(100px; 1fr));
/* other styles... */
}
Why doesn't that work?
Here's a little JS snippet to set columns based on the amount of children elements. Also consider using flex for this