<%= coco_tag(:div, class: "coco-button-wrapper", x: alpine_wrapper_attrs || {}) do %> <%= render component_tag(button_tag, class: { "coco-button": true, "icon-only": icon_only?, "with-icon": (icon? && !icon_only?) }, x: { data: x_data("button", alpine_data), bind: "root", ":disabled": "disabled", "dropdown:trigger": (true if dropdown?), "dropdown:anchor": (true if dropdown?), "@click": ("#{"checkConfirmation($event);" if confirm?} #{on_click}" if confirm? || on_click.present?) } ) do %> <% states.each do |name, props| %> <% if props[:icon].present? %> <% if states.many? %> > <%= props[:icon] %> <% else %> <%= props[:icon] %> <% end %> <% end %> <% end %> <% unless icon_only? %> <% states.each do |name, props| %> <% if states.many? %> > <%= props[:text] %> <% else %> <%= props[:text] %> <% end %> <% end %> <% end %> <% if toggle? %> <% if toggle_direction == :horizontal %> <%= coco_icon(:chevron_right, class: "button-toggle") %> <% else %> <%= coco_icon(:chevron_down, class: "button-toggle") %> <% end %> <% end %> <% end %> <% if dropdown? %>
<%= dropdown %>
<% end %> <% end %>