-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Layout attribute #2173
Comments
@eelcoj, this is possible with current features, like the slot api for example
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. |
@eelcoj thank you for taking the time to share your idea here! I honestly had never heard of the Add
Add
Either way, we'd probably have to support both template file and component layouts. My instinct is to do |
@eelcoj @reeganviljoen thinking about this some more, I realized that we could probably just rely on the built-in Rails API:
To support this, we'll need to make an update to Rails core here: https://github.com/rails/rails/blob/a34fc56f9170dea2b0dfd2a6138c2b57bab35cda/actionview/lib/action_view/helpers/rendering_helper.rb#L149 to pass the I hope to be able to work on a patch for this soon 🤞🏻 |
@joelhawksley That would be even cooler! Let me know if I can help in any way! |
@joelhawksley Agreed this seems like a great idea, and also let me know if you need any help getting a patch done |
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: