Core Concepts of Custom Lightning Types
You build all custom Lightning types, whether Apex-based or object-based, by using a common set of foundational components. Understand these core concepts to create, customize, and deploy your types.
Lightning Type consists of these artifacts.
- Schema defines the data structure and the rules for its validation, such as maximum length, type, and format.
- Editor defines the input UI component that you use to enter or edit data.
- Renderer defines the output UI component that displays data.
The LightningTypeBundle metadata type describes the custom Lightning types. It’s available in API version 64.0 and later.
To get a list of the custom and standard Lightning types deployed in your org, make a call to the /connect/lightning-types resource.
For more information about the resources available in the Type System Connect REST API, see the Type System Resources.
LightningTypeBundle components are stored in the lightningTypes folder.
Here’s an example of the LightningTypeBundle structure.
The bundle includes these resources.
-
The
lightningTypesfolder (1) contains a folder for each custom Lightning type created in the format{typeName}(2). -
Each custom Lightning type folder contains a
schema.jsonfile (3) that defines the JSON schema that drives the custom Lightning type validation. -
Optional channel-specific folders (4). To override the default UI for a specific Salesforce application, the bundle contains a folder named after that channel. The supported channel folders are:
lightningDesktopGenAi(Agentforce Employee agent in Lightning Experience)enhancedWebChat(Agentforce Service agent via Enhanced Chat v2)experienceBuilder(Experience Builder)
Inside the
{channelName}folder, you can configure:-
The
editor.jsonfile (5) containing custom user interface and editor information -
The
renderer.jsonfile (6) containing custom user interface and renderer informationThis file isn’t supported in
experienceBuilder.
To deploy a LightningTypeBundle to your Salesforce org, use Metadata API or SF Commands. The Metadata API uses a manifest file that defines the metadata that you want to deploy.
Here’s an example package.xml manifest file for a LightningTypeBundle that includes the custom Lightning type myFlight.
To delete a custom Lightning type, you must deploy a destructiveChanges package to your org that lists the types to delete.
See Also
- Metadata API Developer Guide: Deploying and Retrieving Metadata with the Zip File
- Metadata API Developer Guide: Deleting Components from an Organization
Retrieve, deploy, and track source control for the LightningTypeBundle metadata type by using SF commands. See source Commands.
Packaging supports the LightningTypeBundle metadata type that describes custom Lightning types. You can include the LightningTypeBundle in first-generation (1GP) and second-generation (2GP) packages. See the First-Generation Managed Packaging Developer Guide and the Second-Generation Managed Packaging Developer Guide.
See Also
- Metadata Coverage Report
- Salesforce CLI Command Reference
- Use Managed Packages to Develop Your AppExchange Solution
The LightningTypeBundle includes these configuration files.
Schema.json
The schema.json file is a required resource in every Lightning Type Bundle. It defines the data structure, validation rules (such as type, format, and maximum length), and constraints for your custom Lightning type by using the JSON Schema specification.
Editor.json
With the optional editor.json file, you can override the default input UI. Use this file to define the specific custom Lightning Web Component (LWC) for entering or editing data.
Renderer.json
With the optional renderer.json file, you can override the default output UI. Use this file to define the custom LWC used to present or display data to the user.
See Also
When you reference metadata such as a custom label or a component in your custom Lightning type, use the correct namespace prefix. This prefix applies to metadata references in your schema, editor, and renderer files.
For metadata created in your org
Use the “c” namespace prefix. This rule applies even if your org has its own namespace. For example, if your org’s namespace is myOrgNamespace and you create an LWC component named flightDetails, refer to it as c/flightDetails.
This rule also applies to custom Lightning types in managed packages. Reference any new metadata in the same package by using the “c” prefix.
For metadata installed via a managed package
Use the package’s unique namespace as the prefix. For example, if a package has the namespace isv and includes an LWC component named flightDetails, refer to it as isv/flightDetails.
Example of Local Org Metadata References
This schema.json file uses the “c” namespace to reference a custom label and the @apexClassType reference of an Apex class.
This renderer.json file uses the “c” namespace to reference a Lightning Web Component.
You can customize labels for the title and description values in the schema.json file for a custom Lightning type.
To create and use a translated custom label in a custom Lightning type, complete these steps.
- From Setup, enter
Labelsin the Quick Find box, and then select Custom Labels. - Create a custom label.
- In the
schema.jsonfile for the custom Lightning type that you created, use the expression{!$Label.c.MyLabel1}for the title and description values. Here, “c” is the namespace prefix and “MyLabel1” is the API name of the custom label.
See Also
You can override the default UI of some Salesforce applications by using a custom Lightning type. Each Salesforce application listens to a specific channel that you specify in your LightningTypeBundle.
You can override these Salesforce applications.
- Agentforce Employee agent in Lightning Experience
- Agentforce Service agent via Enhanced Chat v2
- Experience Builder
- Prompt Builder
- Flows via Structured Outputs
To override the UI, create a folder in your LightningTypeBundle with the application’s corresponding channel name.
| Salesforce Application | Channel Folder | Category |
|---|---|---|
| Agentforce Employee agent in Lightning Experience | lightningDesktopGenAi | Apex |
| Agentforce Service agent via Enhanced Chat v2 | enhancedWebChat | Apex |
| Experience Builder | experienceBuilder | Object |
| Prompt Builder | Not Applicable | Object |
| Flows via Structured Outputs | Not Applicable | Object |
See Also