Part of the app I’m working on will require a series of buttons (they will actually be implemented as an image and a label). They will be presented in a CSSGrid, with each button in a single CSSGridItem. The number of these buttons is dependent on data from a server, so the number is unknown until runtime.
One solution is to have the maximum number of buttons/grid items already defined at design time and hide all the ones not needed. This is very messy at design time. It probably loads the faster than the next option.
Second solution would be to create the griditems and the button and label children at runtime and add them to the CSSGrid using something like https://blog.appstudio.dev/2012/10/creating-runtime-buttons-bonus-a-single-event-for-all-your-buttons/. The CreateDiv sample has similar code.
In the second solution I would create one griditem with children formatted as desired, and then copy the properties from this original to the ones being created. It seems to me that maintenance of the layout of buttons would be much easier with only one to keep up with, rather than dozens that fill up the design screen.