Object-Based Custom Lightning Types

With object-based custom Lightning types, you can define a custom data structure entirely within a JSON schema, without relying on an Apex class. You explicitly define every property, data type, and validation rule in the schema.json file. Use this approach when you need a lightweight, flexible data model for UI configuration or prompt definitions that don’t require an Apex backend.

Supported in:

  • Prompt Builder
  • Experience Builder

For object-based types, you define the data structure directly in the schema.json file by using the lightning__objectType value and a properties block.

This table lists the keywords that you can specify in a schema.json file.

KeywordRequired or OptionalTypeDescription
titleRequiredStringName for the Lightning type
descriptionOptionalStringDescription for the Lightning type
lightning:typeRequiredStringRefers to lightning__objectType type by fully qualified name
propertiesRequiredObjectDefines the fields for the object. Each key is a field name, and its value is an object defining that field’s title and lightning:type.

For a list of valid values, see Lightning Types Reference.
requiredOptionalArrayAn array of property names that must be present in the data

Here’s a sample code that shows the contents of the schema.json file for a custom Lightning type customerFeedback.

When you create or update an object-based custom Lightning type, an Apex class is automatically generated that matches your schema.

See Also

While schema.json defines the data structure, the UI configuration files in the LightningTypeBundle control the visual representation. Organize these files by channel to support specific Salesforce applications.

Channels

Store UI overrides in channel-specific subfolders to target different applications.

  • experienceBuilder. Use this folder for Experience Builder sites.

Configuration Files

You can configure input and output UI overrides by using these JSON files.

  • editor.json. Points to a Lightning Web Component (LWC) that serves as a custom form for data entry.

Component Override

You can customize the visual presentation by adding component overrides to your editor.json file.

  • Top-Level Override. A top-level override replaces the default UI for the entire custom Lightning type. To configure this override, use the $ symbol as the key in the componentOverrides section of your editor.json. This approach is useful for creating specialized interfaces, such as a custom card or a multi-field form handled by a single component.
  • Property-Level Override. A property-level override replaces the default UI for specific properties of a schema within a complex type, while default editors handle the rest of the type. Instead of using $, specify the exact property name (such as address or phoneNumber) as the key in the componentOverrides section. Use property overrides when specific data requires specialized input. Default editors apply to any properties that don’t have a defined override.

Attribute Mapping

In both configuration files, map schema fields to LWC component fields by using the {!\$attrs.FieldName} syntax.

For a complete list of supported channels and detailed JSON syntax, see Lightning Type UI Configuration.

See Also

You can modify custom Lightning types freely until they’re referenced in a Salesforce application. When they’re referenced, follow these guidelines to maintain the integrity of the type across Salesforce applications, such as Experience Builder and Prompt Builder.

KeywordStatusGuideline
titlePermittedYou can change the title of an individual property.
descriptionPermittedYou can change the description of an individual property.
lightning:typeProhibitedYou can’t change the lightning:type value.
propertiesConditionally PermittedAdditive changes: You can add new optional properties.

Destructive changes: You can’t remove or rename an existing property. You can’t add a new required property.
requiredConditionally PermittedYou can make existing required properties optional (remove them from the required list).

You can’t add properties to the required list.
maximumConditionally PermittedYou can increase the value. You can’t decrease it.
minimumConditionally PermittedYou can decrease the value. You can’t increase it.
maxLengthConditionally PermittedYou can increase the value. You can’t decrease it.
minLengthConditionally PermittedYou can decrease the value. You can’t increase it.
multipleOfConditionally PermittedThe existing value must be divisible by the new value.

Example: If the existing value is 20, valid new values include 2, 4, 5, and 10. Invalid values include 15 and 40.
lightning:allowedUrlSchemesConditionally PermittedYou can add new schemes to the array. You can’t remove existing schemes.