Skip to content

[TwigComponent] Passing props from a parent component to a child with different HTML syntax #2514

Closed as not planned
@seb-jean

Description

@seb-jean

Hi,
I have a problem but I don't know if it's a bug or if it's an intended behavior :

I want to pass a props (for my example, the props is called disabled) from a parent component to the child component.

Props are passed when it is a component with a self-closing HTML syntax. For my example: <twig:Form:Label>Description</twig:Form:Label>
However, when it is a component with opening and closing tag HTML syntax, the props are not passed from the parent to the child. For my example <twig:Form:Textarea />

{# templates/index.html.twig #}

<twig:Form:Row disabled>
    <twig:Form:Label>Description</twig:Form:Label>
    <twig:Form:Textarea />
</twig:Form:Row>
{# templates/components/Form/Label.html.twig #}
{{ disabled }}  {# work #}
{# templates/components/Form/Textarea.html.twig #}
{{ disabled }}  {# not work #}

Is this normal?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions