Escape Special XML Characters in Default Values
The default attribute of a property type lets you set a value for the property before an end user has a chance to change the input. Setting the default value of a custom property type from the js-meta.xml file requires you to escape any special characters in that value.
It’s standard practice in XML documents to ensure that special characters in a value don’t affect the validity of the whole XML document. (This consideration generally doesn’t apply to primitive types.) For properties that directly or indirectly reference a custom property type that’s defined in its schema as lightning__objectType, lightning__dateTimeType, or lightning__richTextType, you may need to escape special characters in those values.
For example, if a component has a property tag that uses lightning__richTextType, this is how to specify any HTML or XML usage in the default attribute that you’d have to escape, such as “<strong>bold text</strong>.”
1<property name="richTextProperty" type="lightning__richTextType" default="><strong>bold text</strong>" />
Similarly, if a component has a property type reference that uses the lightning__objectType, this is how to specify a default object value such as ”{“state”:“California”, “city”:“San Francisco”}”.
1<property name="addressProperty" type="c__addressType" default="{"state":"California","city":"San Francisco"}" />
This release is in preview. Features described here don't become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can't guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.