Do we have any body attribute the way we have in aura component, so we can just write the details in between component name tags.

<lwccmp> body details </lwccmp>.

we have body a default attribute in aura component, need this in lightning web component too.

1 Answer 1


You have to use unnamed slots.

<!-- lwccmp.html -->
    <div onprivateitemregister={handleChildRegister}>
        <!– Other markup here -->
        <slot><!-- Body details will be here.--></slot>

More details about slots here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .