Skip to content

Dynamic components do not work with scoped slots #4871

Open
@nolanlawson

Description

@nolanlawson

With scoped slots, this works:

<x-counter>
    <template lwc:slot-data="data">
        <span>{data.id} - {data.name}</span>
    </template>
</x-counter>

However, if that same <x-counter> component is used with <lwc:component> (aka dynamic components):

<lwc:component lwc:is={customCtor}>
    <template lwc:slot-data="data">
        <span>{data.id} - {data.name}</span>
    </template>
</lwc:component>

... then you get an error at compile time:

Error: LWC1178: <template> tag with lwc:slot-data directive must be the direct child of a custom element.

Repro

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions