1

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
   </c:alertMessageAuraLWC>
</aura:component>

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?

1
  • Can you try creating an LWC with the slots and just refer to that LWC instead of using slots in AURA. Mar 27, 2023 at 5:29

1 Answer 1

0

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.

1
  • 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, 2020 at 0:32

You must log in to answer this question.

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