Exposing a custom component's properties in Experience Builder
Key Takeaway
To make a custom component's properties editable in Experience Builder, add lightningCommunity__Default to targets, define the properties in a targetConfig, and declare each one as a public @api property with the same name in the JavaScript class.
A custom Lightning web component can let an admin change its settings, such as a text value or a color, directly in Experience Builder instead of in code. You set this up in two places: the component's .js-meta.xml configuration file and its JavaScript class.
How to make a component usable in Experience Builder
- Open the component's
.js-meta.xmlfile. - Set
isExposedtotrue. - Add a target to
targetsfor the way the component will be used.
| Target | Use it for | Where it appears in Experience Builder |
|---|---|---|
lightningCommunity__Page | A drag-and-drop component | "Components" panel |
lightningCommunity__Page_Layout | A page layout | "Page Layout" window |
lightningCommunity__Theme_Layout | A theme layout | "Settings", in the "Theme" area |