Can you swap multiple components simultaneously with an onClick action?

I have multiple expanding/collapsing boxes. I want to collapse or expand them all at once by clicking an Expand All or Collapse All button.

Is there a way to target multiple swaps on the clicking of a different element?

Thank you!

Yeah, you can wrap them into a component set and have these states there