Generate a UI bundle, which contains the code and metadata to build a UI experience that uses non-native Salesforce frameworks, such as React or Angular.
Description for template generate ui-bundle
Salesforce provides native UI frameworks, such as Lighting Web Components (LWC), to build applications that run on the Salesforce Platform. But you can also use non-native JavaScript- or TypeScript-based UI frameworks, such as React, to build a UI experience for the Salesforce Platform and that you can launch from the App Launcher.
These non-native UI experiences are defined by the “UIBundle” metadata type in your DX project. Use this command to generate the required DX project structure and files. For example, when you run this command and specify the name MyUiBundle, then the files are generated into a “uiBundles/MyUiBundle” directory. Use the –output-dir flag to specify a different directory.
Use the –template flag for generating the files to get started with a specific UI framework, such as React or Angular. Check out the README.md file in the generated “uiBundles/<bundlename>” directory for more information about the template.
Flags
Flag Name (Long)
Flag Name (Short)
Description
‑‑api‑version
N/A
Type: Value
Override the api version used for api requests made by this command
‑‑flags‑dir
N/A
Type: Value
Import flag values from a directory.
‑‑json
N/A
Type: Boolean
Format output as json.
‑‑label
‑l
Type: Value
Master label for the UI bundle.
If not specified, the label is derived from the name.
‑‑name
‑n
Type: Value Required
API name of the generated UI bundle.
This name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.
‑‑output‑dir
‑d
Type: Value
Directory into which the files are created.
The location can be an absolute path or relative to the current working directory.
If not specified, the command reads your sfdx-project.json and defaults to “uiBundles” directory within your default package directory. When running outside a Salesforce DX project, defaults to the current directory.
Important: This command automatically ensures the output directory ends with “uiBundles”. If your specified path doesn’t end with “uiBundles”, it’s automatically appended. The UI bundle is created at “<output-dir>/<name>”.
Examples:
“–output-dir force-app/main/default” → Creates a UI bundle at “force-app/main/default/uiBundles/MyUiBundle/"
"–output-dir force-app/main/default/uiBundles” → Creates a UI bundle at “force-app/main/default/uiBundles/MyUiBundle/” (no change)
‑‑template
‑t
Type: Value Valid Values:default, reactbasic, angularbasic Default value:default
Template to use when creating the files for a specific UI framework.
Supplied parameter values or default values are filled into a copy of the template.
Examples for template generate ui-bundle
Generate a UI bundle called MyUiBundle in the current directory: