I made a Stimulus controller to handle toggling elements. It's basic, but does what I need.
Check it out here: npm, GitHub