Adrian I know the docs aren t ready yet
# avo-2
a
Adrian, I know the docs aren't ready yet, but in a tool, in the tools slot, I want buttons that will interact with a stimulus controller. Do you have an example of that, or can you tell me how to set the various attributes on the html element via the a_link/a_button helpers? (and what's the difference between a_link and a_button?)
l
for the Stimulus integration you can add
data
attributes to
a_link
and
a_button
Copy code
ruby
<%= a_button data: {controller: :foo, action: "click->something#act"} do %>
  hehe
<% end %>
so anything you'd do in a regular rails app goes
the difference between the two is what element they generate
a_link
is obviously a link
a_button
is used for whne you'd like to submit a form or use
method: :delete
or
data: {confirm: "are you sure"}
you can find an example of a resource tool and a button with stimulus here https://main.avodemo.com/avo/resources/fish/9
it uses a
show_controls
button but you can do the same using the
a_button
helper
oh... sorry. that's actually a Turbo demo, not a Stimulus demo
the mechanics should be similar using data attributes
a
yeah close enough
thanks!