Newer Version Available
Component Properties
1<?xml version="1.0" encoding="UTF-8"?>
2<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="myComponent">
3 <apiVersion>51.0</apiVersion>
4 <isExposed>true</isExposed>
5 <masterLabel>Component Name</masterLabel>
6 <description>Description of your component.</description>
7 <targets>
8 <target>lightningCommunity__Page</target>
9 <target>lightningCommunity__Default</target>
10 </targets>
11 <targetConfigs>
12 <targetConfig targets="lightningCommunity__Default">
13 <property type="String" name="stringProp" default="hello world"/>
14 <property type="Integer" name="integerProp" default="314"/>
15 <property type="Boolean" name="booleanProp" default="true"/>
16 <property type="Color" name="colorProp" default="#333333"/>
17 <property type="Picklist" name="picklistProp" datasource="item1,item2"/>
18 </targetConfig>
19 </targetConfigs>
20</LightningComponentBundle>The default value of the property in the js-meta.xml file determines the out-of-the-box value of a component property.
If no default is provided, then we use the value of the corresponding @api variable in the .js file. This value can then be further edited via the component’s property panel in Experience Builder.
When the component is loaded, we attempt to coerce the current value of a component property to its specified JavaScript type in the js-meta.xml file. If there’s no corresponding property at all in the js-meta.xml file and the attribute only exists in the .js file, then the value isn’t coerced.
Component @api properties with values containing expression language syntax (for example, {!recordId}) are only interpolated if there’s a corresponding design property config in the js-meta.xml file. See Make a Component Aware of Its Record Context in the Lightning Web Components Developer Guide.