Troubleshooting
Diagnose the symptoms that are easy to misread as "the gem is broken."
Component renders but interactions do nothing
Symptom. A dialog/menu/accordion/etc. renders fine, looks fine, but clicking the trigger does nothing. No errors in the browser console.
Root cause (99% of the time). The Stimulus identifier on the rendered HTML does not match
the identifier your controllers/index.js registered. Stimulus is silent about this: no controller
matches the element, so nothing fires.
Diagnosis ladder
-
Inspect the rendered DOM. Find the component's wrapper element and read the
data-controllerattribute. That string is the source of truth. -
Compare it to
app/javascript/controllers/index.js. Find theapplication.register("...", XController)line for that component. The first argument must match exactly.- If the DOM says
data-controller="dialog", you needapplication.register("dialog", ...). - If the DOM says
data-controller="rui--dialog", you needapplication.register("rui--dialog", ...).
- If the DOM says
-
Check
config.stimulus_namespaceinconfig/initializers/rapid_rails_ui.rb. If it's set to"rui", every gem-emitted identifier is prefixed withrui--. The cleanest fix is to re-run the installer with--stimulus-namespace=rui, which rewritesindex.jsto match. See Stimulus Namespace . -
Custom triggers in your own templates. If you wrote
<button data-action="dialog#open">outside the component slot, that action string must use the same identifier the gem emits. Withstimulus_namespace = "rui", writedata-action="rui--dialog#open"— or use thestimulus_action(:dialog, "click->#open")helper, which adapts automatically. - v0.47.0 with namespace set: known caveat. On v0.47.0, a handful of internal component templates (Dialog, Pagination, Steps) still emit hardcoded unnamespaced action strings for built-in close / backdrop / paginate handlers. Custom triggers you write yourself work; built-in ones may not. Patched in the next release.
Forward reference: a future release ships a guardCollisions JS helper that
throws on duplicate Stimulus registrations so this class of bug fails loudly instead of silently. See the
Changelog
when it lands.
esbuild fails: "The symbol X has already been declared"
Your app already declares a JS class named AccordionController, DialogController, etc.,
and esbuild trips when the gem imports its same-named class into the same module.
Re-run the installer with the namespace-imports flag (v0.46.0+):
rails g rapid_rails_ui:install --namespace-imports=Rui
Full context on the Installation page (advanced section).
Native inputs render alongside the gem's styled inputs
A bare <input type="checkbox"> sits next to (or on top of) the gem's styled checkbox. Same
pattern can appear with radio, text, or search inputs.
Root cause: your host app has an unscoped global rule like input[type="checkbox"] { ... } that wins
on specificity against the gem's .sr-only. Surgical fix: exclude the gem's hidden inputs by adding
:not(.sr-only):not(.peer) to each selector. Full walkthrough on the
Installation page
.