Container
lightning:container
Hosts content that uses a third-party JavaScript framework such as Angular or React. For Aura components only.
For Use In
Lightning Experience, Experience Builder Sites, Salesforce Mobile App
The lightning:container component allows you to host content developed with a third-party framework within a Lightning component. The content is uploaded as a static resource, and hosted in an iFrame. The lightning:container component can be used for single-page applications only.
This is a simple example of lightning:container, which loads an app that's uploaded as a static resource named myReactApp.
To pass a value of an attribute to the container via its URL, define the attribute in your component and pass it in using the src attribute.
You can also implement communication to and from the framed application, allowing it to interact with Salesforce. Use the message() function in the JavaScript controller to send messages to the application, and specify a method for handling messages with the component’s onmessage attribute.
This example defines attributes for a message to send from the container to the Lightning component and for a message received.
The client-side controller uses the message() function to send a simple JSON payload to an AngularJS app.
Because you define the controller-side message handling yourself, you can use it to handle any kind of message payload. You can, for example, send just a text string or return a structured JSON response.
When specifying the src of the container, don’t specify a hostname. Instead, use $Resource with dot notation to reference your application, uploaded as a static resource.
For more information, see the Lightning Aura Components Developer Guide.
Use the alternativeText attribute to provide assistive text for the lightning:container.