stimulus-reveal-controller
stimulus-reveal-controller copied to clipboard
Suggestion: Support Action Parameters to allow targeting specific items
With a setup like this, you cannot use reveal
, right?:
<button>Toggle Foo</button>
<button>Toggle Bar</button>
<div>Foo</div>
<div>Bar</div>
...Since you'd have to wrap it in one controller, and then each button would toggle both <div>
s.
What about adding an Action Parameter that passes a CSS selector, like this?:
<button data-action="reveal#toggle" data-reveal-item-param="#foo">Toggle Foo</button>
<button data-action="reveal#toggle" data-reveal-item-param="#bar">Toggle Bar</button>
<div id="foo">Foo</div>
<div id="bar">Bar</div>