You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to check how you feel about adding support for a "layout" attribute in ViewComponent. This should work similarly to Rails partials' layout attribute:
This would come in handy most often when rendering a collection. The ViewComponent renders the collection (eg. li, but not the wrapping element (eg. <ul>).
@eelcoj, this is possible with current features, like the slot api for example
<%= render(AdminComponent.new()) do |c| %>
<% c.with_body do %>
<%= render(UserComponent.new(user: @user) %>
<% end %>
<% end %>
all that said the example above is a lot more dense and could possibly benefit from a layout api, I would like to however ask @joelhawksley what his thoughts are.
Feature request
I want to check how you feel about adding support for a "layout" attribute in ViewComponent. This should work similarly to Rails partials' layout attribute:
This would wrap the user partial with app/views/shared/_admin.html.erb.
For ViewComponent this could be:
Motivation
This would come in handy most often when rendering a collection. The ViewComponent renders the collection (eg.
li
, but not the wrapping element (eg.<ul>
).The only mention of this seems to be here: #198
if this sounds interesting, I am happy to spend some time on it.
The text was updated successfully, but these errors were encountered: