Newer Version Available

This content describes an older version of this product. View Latest

Create Multiple Components on a Web Page with Lightning Out

Lightning Out allows you to create Salesforce components outside of the Salesforce domain.

The legacy chat product is in maintenance-only mode, and we won't continue to build new features. You can continue to use it, but we no longer recommend that you implement new chat channels. Instead, you can modernize your customer communication with Messaging for In-App and Web. Messaging offers many of the chat features that you love plus asynchronous conversations that can be picked back up at any time.

Important

To create these components with Lightning Out on the same web page as an Embedded Service component, use "embeddedService:sidebarApp" as your application tag in your call to $Lightning.use.

In this code sample, we create a `HelloWorldComp` component in the body of the HTML document where an Embedded Service component is rendered.

Component Code

1$Lightning.use(
2    "embeddedService:sidebarApp",
3    function () {
4        $Lightning.createComponent(
5            "c:HelloWorldComp",
6            { … },
7            document.body,
8            function (cmp) {
9                console.log("callback");
10            }
11        );
12    },
13    “communityEndpointUrl”,
14    ...
15);