> For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt.

# loadTemplate

APISummary
Using [`LynxLoadMeta`](/next/api/lynx-native-api/lynx-load-meta.md) to render `LynxView`, it is the main entrance for the client to load `Lynx` templates.

## Syntax

### Android

```java
public void loadTemplate(@NonNull LynxLoadMeta meta);
```

#### Parameters

- `meta`: Lynx template loads metadata, and developers use this data structure to specify optional data loaded by the template.

### iOS

```objc
- (void)loadTemplate:(nonnull LynxLoadMeta *)meta;
```

#### Parameters

- `meta`: Lynx template loads metadata, and developers use this data structure to specify optional data loaded by the template.

### Harmony

LynxView has the following members:

- `url: String `: Template file path.
- `buffer: ArrayBuffer`: The binary file data of the template.
- `templateBundle: TemplateBundle`: [TemplateBundle](/next/api/lynx-native-api/template-bundle.md) object parsed in advance by the template's binary file data.
- `metaData: MetaData`: Initial data specified by the client during the first screen loading process.
- `loadOption: LynxLoadOption`: Additional configuration information when loading templates.

```typescript
@Entry
@Component
struct Index {
  private url: string = 'playground/main.lynx.bundle';
  private buffer: ArrayBuffer = getTemplateBuffer();
  private metaData = new MetaData(
    new TemplateData('{"text":"TD"}'),
    new TemplateData({ "theme": "Light" }));

  build() {
    Column() {
      LynxView({
        url: this.url,
        buffer: this.buffer,
        metadata: this.metaData,
      }).width('100%').height('100%');
    }
    .size({ width: '100%', height: '100%' })
  }
}
```

### Web

```typescript
const lynxView = document.createElement('lynx-view');
lynxView.url = 'path/to/your/template.bundle';
```

### Desktop (C++)

```cpp
void LoadTemplate(std::shared_ptr<lynx::pub::LynxLoadMeta> load_meta);
```

#### Parameters

- `load_meta`: The load metadata used to provide the template URL, binary data, template bundle, initial data, and global props.

## Compatibility

**Compatibility Table**

**Query:** `lynx-native-api.lynx-view.load-template`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/lynx-native-api/lynx-view/load-template.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| load-template | Yes (2.8) | Yes (3.4) | Yes (2.8) | Yes (3.7) | Yes (3.7) | Partial |

**`load-template`**

load a lynx template file by LynxView.

**Specifications:**

- **Web — Supported (version unknown):** Partial support; use the <code>url</code> property

