Skip to content
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

[LiveComponent] Inheritance in live components #2217

Open
tito10047 opened this issue Sep 27, 2024 · 3 comments
Open

[LiveComponent] Inheritance in live components #2217

tito10047 opened this issue Sep 27, 2024 · 3 comments

Comments

@tito10047
Copy link

It would be nice if you could inherit live component from normal component.

{# templates/components/Alert.html.twig #}
<div {{ attributes.defaults({class: 'alert alert-'~type}) }}">
    {% block content %}{% endblock %}
</div>
{# templates/components/SuccessAlertLiveComponent.html.twig #}
{% component Alert with attributes.defaults({class:"foo"}) %}
    {{ block(outerBlocks.content) }}
{% endcomponent %}

Is something like this possible?

@tito10047 tito10047 added the RFC label Sep 27, 2024
@smnandre
Copy link
Collaborator

LiveComponent have no knowledge of their "outerblocks" so it would not work during re-render

@smnandre smnandre changed the title Inheritance in live components [LiveComponent] Inheritance in live components Sep 27, 2024
@tito10047
Copy link
Author

Yes, of course. Stupid example copied from docs.
I have problem only with this "with attributes.defaults({class:"foo"})" . With this I get parse error

@smnandre
Copy link
Collaborator

Can you maybe show the code that triggers this error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants