---
title: ui-import
project: jComponent V20
version: 20.015
section: reference
language: en
license: MIT
url: https://totaljs.es/docs/jcomponent-v20/20-015/reference/ui-import/
updated: 2026-11-18T13:58:19.462Z
---

# ui-import

> The attributes and the config keys of the ui-import element.

The `<ui-import>` element downloads content from your server and inserts it into the page. It uses `IMPORT()`, described in the [Importing content](../../guides/importing/) guide together with the flags that the address accepts.

## API

### path="URL"

Type: `property`

The address of the content.

The address can carry the flags of `IMPORT()`, for example `/parts/menu.html @prepend`. The content is appended to the element unless `target` says otherwise.

Example: Import a part of the page
```html
<ui-import path="/parts/menu.html"></ui-import>
```

### config="key:value;key:value"

Type: `property`

The options of the import.

The format is the same as in [ui-component](../ui-component/).

### plugin="path"

Type: `property`

Creates a plugin on the element itself.

The plugin is created ahead of the download, so the imported content can use its path.

Example: Import into a new plugin
```html
<ui-import path="/parts/form.html" plugin="myform"></ui-import>

<script>
PLUGIN('myform', function(exports) {
    console.log('plugin', exports.path.toString());
});
// logs: plugin myform
</script>
```

### url:address

Type: `config`

The address of the content, used when the `path` attribute is empty.

Example: Set the address in the configuration
```html
<ui-import config="url:/parts/footer.html"></ui-import>
```

### target:selector

Type: `config`

Inserts the content into another element.

Example: Choose where the content goes
```html
<div id="content"></div>
<ui-import path="/parts/news.html" config="target:#content"></ui-import>
```

### path:value

Type: `config`

Replaces the keywords `~PATH~` and `CLASS` in the imported content.

The value is also added to `<ui-plugin>` elements without a `path` attribute, and given as the name to a `PLUGIN(function(...` declaration without a name.

Example: Reuse one part with different paths
```html
<ui-import path="/parts/item.html" config="path:orders;id:o1"></ui-import>
```

### id:value

Type: `config`

Replaces the keyword `~ID~` in the imported content.

### init:path

Type: `config`

Calls a function when the content is in the page.

A value that starts with `?` refers to the closest plugin of the target element.

Example: Run code after the import
```html
<ui-import path="/parts/chart.html" config="init:FUNC.imported"></ui-import>

<script>
FUNC.imported = function() {
    console.log($('ui-import canvas').length);
};
// logs: 1
</script>
```

### class:name

Type: `config`

Toggles a CSS class on the target element when the content is in the page.

Example: Mark the element as loaded
```html
<ui-import path="/parts/text.html" config="class:loaded"></ui-import>
```
