I am building some Lightning Web Components for a Community for the first time and would like to add Config data to the Metadata file. What needs to be done to allow admins to be able to for example: choose background color or hide a button.

I understand that something similar to below should be added to the metadata file. What would need to be added to the JS & HTML file?

    <targetConfig targets="lightningCommunity__Default">
        <property name="backgroundColor" type="Color" default="#ff00ff"></property>

1 Answer 1


You need to create a property with @api annotated with same same name you have in configuration file.

So in your component-name.js file, You need to add below property to get the value from community builder.

@api backgroundColor;

You can further use the property in your html file as per requirement.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .