Salesforce Asked by Renato Oliveira on December 12, 2020
Currently I have a LWC that has a <slot>
inside of it to allow content between the tags. To test said component, I wanted to spin up a scratch org and quickly create a component. Since we can’t create LWC inside the console, I created an Aura component instead.
The markup is similar to this:
<aura:application extends="force:slds">
<div class="slds-box">
<c:tokenLocker recordId="5001A0000000000AAA"
passTokenToCallbackClass="true">
<h1>Hello world!</h1>
<p>Lorem ipsum, dolor</p>
</c:tokenLocker>
</div>
</aura:application>
When the LWC tokenLocker
displays the content, I simply get an empty div on screen, and no content is displayed at all.
I looked into the LWC documentation and found that in the section “Pass Markup into Slots” there’s this note right at the beginning of the document:
You can’t pass an Aura component into a slot.
I understand that it is not possible to pass an Aura component, but is this valid for simple HTML tags too?
In Aura, all HTML components are converted to aura:html components:
A meta component that represents all html elements. Any html found in your markup causes the creation of one of these.
In Aura, you can only pass in other LWC because of this limitation. In LWC, you can use both other LWC and HTML elements equally.
Correct answer by sfdcfox on December 12, 2020
0 Asked on December 4, 2020 by varun-r
1 Asked on December 4, 2020
2 Asked on December 4, 2020 by varunc
1 Asked on December 4, 2020 by jay-bolt
0 Asked on December 3, 2020 by edelrabe
4 Asked on December 3, 2020 by jeff-swatt
2 Asked on December 2, 2020 by giorgos-galaios
1 Asked on December 2, 2020 by vishu
2 Asked on December 1, 2020 by keith-c
lightning inputfield lightning recordeditform lightning web components
1 Asked on December 1, 2020 by michael-canelas
0 Asked on December 1, 2020 by sfdc_beginner1
1 Asked on December 1, 2020 by tarponjargon
1 Asked on November 30, 2020 by questionasker123
1 Asked on November 29, 2020 by user1813867
0 Asked on November 28, 2020 by rivu-indra
contentdocumentlink lightning process builder toast visual workflow
1 Asked on November 27, 2020 by bpilling
1 Asked on November 23, 2020 by sumitsing-ingle
Get help from others!
Recent Questions
Recent Answers
© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP