# template generate ui-embedding

Generate a Lightning Web Component (LWC) bundle that wraps the \<lightning-ui-embedding> base component.

## Description for template generate ui-embedding

The generated LWC bundle consumes the first-party \<lightning-ui-embedding> 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ---------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--api-version`  | N/A               | **Type:** Value<br><br>Override the api version used for api requests made by this command                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `--flags-dir`    | N/A               | **Type:** Value<br><br>Import flag values from a directory.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `--json`         | N/A               | **Type:** Boolean<br><br>Format output as json.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `--name`         | `-n`              | **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.                                                                                                                                                                                                                                                                                                                                            |
| `--output-dir`   | `-d`              | **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.                                                                                                                                                                                                                                                                                                                                                                                      |
| `--sandbox`      | 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 <lightning-ui-embedding>. Only W3C-defined sandbox tokens are accepted. |
| `--src`          | `-s`              | **Type:** Value<br>**Required**<br><br>Absolute HTTPS URL that the iframe will load.<br><br>The URL is bound to the <lightning-ui-embedding> "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).                                                                                                                                                                                                                                                                                                      |
| `--title`        | N/A               | **Type:** Value<br>**Required**<br><br>Accessible title for the embedded iframe.<br><br>Written to the "shell-title" attribute on <lightning-ui-embedding> 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
```
