Hotwire Discussion

How add a css class on a turbo frame?

Is it possible to add a turbo frame in rails on a custom html tag or add a css class on a turbo frame please?

My problem:

A turbo frame wrap each article and the col-span-2 has no effect, how to move the “col-span-2” class on the turbo-frame tag please?

I have two article preview by row, and when I click on an article, I want have the article in full size, ex:

article | article
article | article
article | article
article | article


Did you attempt to add a class attribute to the turbo-frame tag to see what would happen?

It doesn’t work, I use a data-controller="add-class-to-parent-turbo-frame" controller and the controller is not connected, why please?

What I meant by my prior comment is to simply add the class manually to the turbo-frame, now through javascript:

<turbo-frame id="post_20" class="flex col-span-2"....>

Are you trying to add it through javascript?

Without seeing both html and javascript code, I cannot answer your question of why the "controller is not connected.