Hi I wanted to use slots. I know it is supported in LWC and it works fine. I have scenario where I have AURA component (Parent) having LWC (Child).

<aura:component controller="OpportunityData"> -> This is Aura Component
   <c:alertMessageAuraLWC aura:id="alertMessageLWC"> -> This is LWC
       <p slot="slot1">I am coming from parent</p> -> Slot

If you see here, I am using slot1 for identification of my slot content.

My Question is, inside Aura Component can we have LWC component with slot? If not, what is another approach I can follow to get similar done?


See the similar answer: Can I pass HTML markup as the content for a LWC slot when used in an Aura component?

No, passing Html markup is not possible.

However, if you just want to pass the text, you can create @api variable and show that in the markup. And moreover, you can add some additional variables to customize it further.

But my suggestion would be to either convert both to LWC or convert both to Aura. That will make it a lot easier.

  • Basically, it is not possible. I need to make both parent and child LWC to use slot i.e. passing HTML. In my case, I have like text with anchor tag, there can be n-numbers of anchor tags with random placed between or around dynamic text. This can only be done using LWC SLOT.
    – SVinayaka
    Oct 26 '20 at 0:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.