When you look for methods to collapse/expand a collapsible region (e.g. using a button), you find all sorts of suggestions.
Almost none of those seem to work (anymore) however - the only one I got to work properly was suggested by John Snyders on Apex 20.1 - Expand/Collapse All Regions with DA question
See the example below. I used IDs instead of "find" in the jQuery selector, but the idea is the same.