Use Components From a Managed Package

Managed packages can provide helpful functionality for your org. Some managed packages include managed Lightning web components. After installing a managed package via AppExchange, you can reference a managed Lightning web component (LWC) that’s included in a managed package by using it in your custom component.

Authors of managed packages must test with both Lightning Locker and Lightning Web Security (LWC) to make sure their components work in both environments. To ensure that the managed package works in orgs where LWS isn’t enabled, don’t rely on LWS-only features. We recommend installing and testing the managed package in a sandbox first before installing it in your production orgs.

Important

Use a Managed LWC in a Custom Component 

A Lightning web component in a managed package has a different namespace than your own. We recommend that you refer to the documentation on the managed package.

When you use an LWC from a managed package in your custom component, use kebab case (dash-separated). Similarly, the global attributes you use in the LWC HTML template must use kebab case.

For example, if the managed package contains an LWC in the lwc_partner namespace and the managed component name is account-verification, you can reference the component like this.

1<!-- myComponent.html -->
2<template>
3  <lwc_partner-account-verification attribute-name="value"> </lwc_partner-account-verification>
4</template>

Use a Managed LWC in a Salesforce Target 

A managed LWC can be used in different LWC targets, which you can verify with the corresponding managed package documentation. For example, if you use the managed LWC in your custom LWC, you can surface the managed LWC in various targets by updating the <targets> configuration tag.

1<?xml version="1.0" encoding="UTF-8"?>
2<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
3  <apiVersion>58.0</apiVersion>
4  <isExposed>true</isExposed>
5  <targets>
6    <target>lightning__RecordPage</target>
7    <target>lightning__AppPage</target>
8    <target>lightning__HomePage</target>
9  </targets>
10</LightningComponentBundle>

See Also

Release Preview

This release is in preview. Features described here don't become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can't guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.