Can you expand all items in array by default?

As title suggests is it possbile to expand all items in an array by default or will this require extending the array renderer via a custom renderer?

I’m assuming you are referring to the React Material renderer set? In there it’s currently not possible to change the default. In the code we even make sure that always only a single element is expanded.

To adapt this you will need to implement a custom renderer. Here you can find the off-the-shelf renderer for inspiration. Here is the expand logic.

1 Like

Hi @sdirix I’ve just revisited this feature and the requirments have changed slightly. Rather than expanding by default I’d like a button to expand all. I already have a custom MaterialArrayLayout renderer to which I have added a button but I am unsure how to actually target the expanded prop on each of the ExpandPanelRenderers.

Firstly does this approach sound feasible? Thanks.

To expand all, all you need to do is handle the expansion logic differently. For example instead of tracking the index of the one single expand you could store for all elements whether they are expanded or not. The “Expand all” button then just sets all of them to expanded. This should all be achievable within your custom MaterialArrayLayout.

1 Like