Skip to content

[TwigComponent] Nested components - access to child components #2968

@SimonMellerin

Description

@SimonMellerin

Hi,

It could be nice to be able to list and access child block from their parent twig component.

Here is my use case, a component that can dynamically define a table with columns, like this:

 <twig:Table:Table :data="myData">
    <twig:Table:Column id="email" label="E-mail" :sortable="true">
        {{ item.email }}
    </twig:Table:Column>
    <twig:Table:Column id="statuts" label="Statut">
        {{ item.statut.label }}
    </twig:Table:Column>
    <twig:Table:Column id="actions" labelSr="Actions">
        <twig:Base:Button
            title="See user detail"
            icon="ph:eye-duotone"
            class="my-0"
            href="{{ url('user_view', {user: item.id}) }}"
        />
    </twig:Table:Column>
</twig:List:Table>

Currently, I have no possibility to know from twig:Table:Table how many columns I have and which label I need to put in my <th> tags.

Actually, what I want to do is to reproduce a way to describe table as Primevue does: https://primevue.org/datatable/

What do you think ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFCRFC = Request For Comments (proposals about features that you want to be discussed)TwigComponent

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions