Embeddable LWC Components

From 3B Knowledge
Jump to navigation Jump to search

Version 5.5 of Portals adds support for embedding LWC components. Embedded components

Usage

Portal Component

Simply drag and drop the "Custom LWC" component in the portal builder. In the traits (config) of the component, you can add one or multiple parameters to be passed to the LWC component. Usually, you would pass recordId as the key and {{contactUser.Id}} as the value. This way, you would be passing the logged in contact's id to the record-id attribute of the LWC component.

In the Component Name field in the traits, pass the fully qualified LWC component name. For custom components created in the org, use c:componentName, for namespaced components, use namespace:componentName.

Important

There are a few important notes about using LWC in 3B Portals:

  • The LWC component will not have access to the User global context. It should rely on contactId / recordId to identify the user as in the world of 3B Portals, we do not have a Digital Experience user
  • You can pass multiple parameters to the LWC by simply defining them as parameters in the output component.
  • LWC components must have "<isExposed>true</isExposed>" in their .js-meta.xml definition

Limitations

Please read this article (and all related articles) to understand the limitations of this mechanism.