StudioComponents
StudioComponents copied to clipboard
Add support for different UILayouts in VerticalCollapsableSection
Currently, the VerticalCollapsableSection component uses UIListLayout. A better alternative to UIListLayout for this component would be UITableLayout.
Generally I have found that the use cases for this section point more towards using a List- rather than TableLayout here, most obviously for creating panels similar to sections in the properties widget. I think a List layout is more flexible because it allows you to have varying sizes along the same row.
In the properties widget case, this also matches up more closely with how I would expect child components to be designed - one entry per row, containing both the left-hand side (property name) and the right-hand side (property value). A table layout would require the name and value components to be separate, or to return a fragment, which strikes me as a weird design.
Not convinced by the change as it stands but feel free to provide more use cases. We could also think about adding some flexibility here and letting the user provide props to decide which layout they want to use. This is what we do in the ScrollFrame component. An alternative would be to provide the layout itself as a Roact element in a specific prop.