stimulus-reveal-controller icon indicating copy to clipboard operation
stimulus-reveal-controller copied to clipboard

Suggestion: Support Action Parameters to allow targeting specific items

Open ThomasLandauer opened this issue 1 year ago • 0 comments

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>

ThomasLandauer avatar Dec 19 '23 13:12 ThomasLandauer