palantir-foundryfoundry-workshop

Can I conditionally expand/collapse a Section in my Workshop App based on whether another section is expanded/collapsed?


I have a Workshop App with two sections that involve two different workflows. The user will only be working in one section at a time and I want to free up more screen space by collapsing the unused section. Is there a way to automatically expand/collapse one section based on the expanded/collapsed state of the other section?


Solution

  • There is no native way to do this, but you can achieve it by creating a Button Group widget and adding events that Toggle the sections:

    enter image description here

    In your Section configs you can set which Section is expanded initially (Here Section 1 is open initially and section two is not):

    enter image description here

    So when you open your app in viewing mode it looks like this:

    enter image description here

    And after clicking the Section Toggle button:

    enter image description here