---
schema_version: "1"
id: f084affa278a4099222a719a88bea4d524b894b8937d191ea0e55152e1e96ed4
title: template generate ui-embedding
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfclireference/guides/template/cli_reference_template_generate_ui-embedding.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_template_generate_ui-embedding.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 65fdf27bf6dbc2f88040f15f1d9b0b0d77dbe0fab05c3e676ef982b3a8a5fe5c
products:
  - Salesforce CLI Command Reference
  - salesforcedx
---
<!-- prettier-ignore-start -->

# template generate ui-embedding

Generate a Lightning Web Component (LWC) bundle that wraps the &lt;lightning-ui-embedding&gt; base component.

## Description for template generate ui-embedding

The generated LWC bundle consumes the first-party &lt;lightning-ui-embedding&gt; component, which is pre-wired with the three required attributes: the embedding URL (--src), iframe sandbox tokens, and an accessible iframe title (--title).

The generated LWC bundle contains four files (.html, .js, .js-meta.xml, .css) in a directory named with the camelCased component name. The bundle must live under a parent folder named "lwc".

## Flags

| Flag Name (Long) | Flag Name (Short) | Description |
|------------------|-------------------|-------------|
| <code>&#8209;&#8209;api&#8209;version</code> | N/A | **Type:** Value<br><br>Override the api version used for api requests made by this command |
| <code>&#8209;&#8209;flags&#8209;dir</code> | N/A | **Type:** Value<br><br>Import flag values from a directory. |
| <code>&#8209;&#8209;json</code> | N/A | **Type:** Boolean<br><br>Format output as json. |
| <code>&#8209;&#8209;name</code> | <code>&#8209;n</code> | **Type:** Value<br>**Required**<br><br>Name of the generated component; must be in PascalCase format.<br><br>The component name is also used (camelCased) as the LWC folder name and file stem. Must contain only alphanumeric characters and start with a letter. |
| <code>&#8209;&#8209;output&#8209;dir</code> | <code>&#8209;d</code> | **Type:** Value<br>**Default value:** `.`<br><br>Directory for saving the created files.<br><br>The location can be an absolute path or relative to the current working directory. The default is the current directory. |
| <code>&#8209;&#8209;sandbox</code> | N/A | **Type:** Value<br>**Required**<br>**Valid Values:** `allow-forms`, `allow-modals`, `allow-orientation-lock`, `allow-pointer-lock`, `allow-popups`, `allow-popups-to-escape-sandbox`, `allow-presentation`, `allow-same-origin`, `allow-scripts`, `allow-storage-access-by-user-activation`, `allow-top-navigation`, `allow-top-navigation-by-user-activation`<br><br>Iframe sandbox token. Specify this flag multiple times to set more than one token.<br><br>Each token is written into the space-separated "sandbox" attribute on &lt;lightning-ui-embedding&gt;. Only W3C-defined sandbox tokens are accepted. |
| <code>&#8209;&#8209;src</code> | <code>&#8209;s</code> | **Type:** Value<br>**Required**<br><br>Absolute HTTPS URL that the iframe will load.<br><br>The URL is bound to the &lt;lightning-ui-embedding&gt; "src" attribute as a reactive property in the generated LWC. Must use HTTPS; plain HTTP is allowed only for localhost or 127.0.0.1 (for local development). |
| <code>&#8209;&#8209;title</code> | N/A | **Type:** Value<br>**Required**<br><br>Accessible title for the embedded iframe.<br><br>Written to the "shell-title" attribute on &lt;lightning-ui-embedding&gt; and used as the iframe's accessible name (announced by screen readers). |

## Examples for template generate ui-embedding

Generate an embedding wrapper LWC in the current directory:

```shell
sf template generate ui-embedding --name MyEmbeddingWrapper --src https://app.example.com --sandbox allow-forms --title "Expense Report Embedding"
```

Generate an embedding wrapper LWC in the "force-app/main/default/lwc" directory with multiple sandbox tokens:

```shell
sf template generate ui-embedding --name MyEmbeddingWrapper --src https://app.example.com --sandbox allow-forms --sandbox allow-scripts --title "Expense Report Embedding" --output-dir force-app/main/default/lwc
```
<!-- prettier-ignore-end -->
