RRUI-003 · Button · Form builder

f.rui_button drops the icon slot block

Icons worked with standalone rui_button, but the same with_icon block on form.rui_button never rendered — the FormBuilder method did not forward the block to render_in.

Fixed · 0.51.2 reported against 0.51.1 resolved 2026-08-07

Resolution (gem owner). The form builder wrapper simply never forwarded the block. As of v0.51.2, all eleven f.rui_* methods were audited; the ten that had the same gap were fixed, and a permanent parity test suite was added so this class of bug cannot come back quietly. Broader form-builder hardening (Rails-compatible index:/string args, etc.) continued in v0.53.0.

Summary

Surface RapidRailsUI::FormBuilder#rui_button
Status Fixed in 0.51.2
Cause Wrapper never accepted / forwarded &block to render_in
Now Block forwarding across audited f.rui_* methods + parity tests

Repro (historical)

<%= form_with model: @record do |form| %>
  <%= form.rui_button("Send Enquiry", type: :submit, color: :primary) do |button| %>
    <% button.with_icon(name: :pencil, position: :trailing) %>
  <% end %>
<% end %>
  1. Was: Button label only — no icon in the DOM.
  2. Expected / now: Same as standalone rui_button — trailing icon rendered.

Contrast — this always worked:

<%= rui_button("Send Enquiry", type: :submit, color: :primary) do |button| %>
  <% button.with_icon(name: :send, position: :trailing) %>
<% end %>

Evidence (0.51.1)

ViewHelper forwarded the block

def rui_button(*args, **kwargs, &block)
  rapidui_component Button::Component, *args, **kwargs, &block
end

FormBuilder did not

def rui_button(text = nil, **options)
  RapidRailsUI::Button::Component.new(
    text,
    form: self,
    **options
  ).render_in(@template)  # ← no &block
end

Ruby silently discarded the caller’s block when the method neither yielded nor took &block.

What landed in the gem

def rui_button(text = nil, **options, &block)
  RapidRailsUI::Button::Component.new(
    text,
    form: self,
    **options
  ).render_in(@template, &block)
end