Reference a Custom Property Type by Type Attribute

A component property can reference a custom property type via the existing type attribute. Previously, the type property was limited to a specific set of types, such as String, Integer, Boolean. Now the type property can be a fullyQualifiedName string that references a standard Lightning type or a custom LightningTypeBundle.

In the Custom Article component example, update the js-meta.xml file for CustomArticle and use the type attribute to reference a Lightning property type for the articleDate property.

1<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="customArticle">
2 <masterLabel>Custom Article</masterLabel>
3 <apiVersion>66.0</apiVersion>
4 <targets>
5   <target>lightningCommunity__Page</target>
6   <target>lightningCommunity__Default</target>
7 </targets>
8 <targetConfigs>
9   <targetConfig targets="lightningCommunity__Default">
10     <property  name="articleDate" type="lightning__dateType" label="Date Updated" />
11   </targetConfig>
12 </targetConfigs>
13</LightningComponentBundle>

In the same component example, you use the type attribute to reference the custom property type layoutProperty.

1<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="customArticle">
2 <masterLabel>Custom Article</masterLabel>
3 <apiVersion>66.0</apiVersion>
4 <targets>
5   <target>lightningCommunity__Page</target>
6   <target>lightningCommunity__Default</target>
7 </targets>
8 <targetConfigs>
9   <targetConfig targets="lightningCommunity__Default">
10       <property name="layoutProperties" type="c__layoutProperty" label="Layout" />
11   </targetConfig>
12 </targetConfigs>
13</LightningComponentBundle>

You can override the label and description attributes in the <property> definition of a custom property type. A change to the label attribute overrides the property’s title attribute.

In the preceding example, the layoutProperty label “Layout” overrides the title “Layout Properties” specified in the schema.json file.

See Also