---
title: ui-import
project: jComponent V19
version: 19.194
section: reference
language: en
license: MIT
url: https://totaljs.es/docs/jcomponent-v19/19-194/reference/ui-import/
updated: 2026-11-18T13:58:29.465Z
---

# ui-import

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

The `<ui-import>` element downloads HTML and inserts it into the page. The content can declare plugins and components, which are compiled after the insertion. [Importing content](../../guides/importing/) explains the concept.

## API

### path="url"

Type: `property`

Sets the URL of the content.

The [`url`](#url) key has priority over this attribute. A URL with the prefix `once ` or `!` is imported only once in the page.

Example: Importing a page
```html
<ui-import path="/users.html"></ui-import>
```

Example: Importing only once
```html
<ui-import id="a" path="once /users.html"></ui-import>
<ui-import id="b" path="once /users.html"></ui-import>
```

### config="key:value"

Type: `property`

Configures the import.

The value is a list of `key:value` pairs. The keys are listed on this page.

Example: URL in the configuration
```html
<ui-import config="url:/users.html"></ui-import>
```

### plugin="path"

Type: `property`

Creates a scope directly on the element.

The value is the path of the scope.

Example: A scope on the element
```html
<ui-import plugin="users" path="/users.html"></ui-import>

<script>
    PLUGIN('users', function(exports) {});
    setTimeout(() => console.log($('b').scope().path), 500);  // users
</script>
```

### url:url

Type: `config`

Sets the URL of the content.

The prefixes `once ` and `!` work as in the [`path`](#path) attribute.

Example: Setting the URL
```html
<ui-import config="url:/users.html"></ui-import>
```

### path:path

Type: `config`

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

The value also adds the path to `<ui-plugin>` elements without a path and to an anonymous `PLUGIN(function(...))` declaration, so one file can be imported several times.

Example: Adapting the content
```html
<ui-import config="url:/part.html;path:users"></ui-import>
```

### id:identifier

Type: `config`

Replaces `~ID~` in the content.

Example: Adapting the content
```html
<ui-import config="url:/part.html;id:box1"></ui-import>
```

### cache:expiration

Type: `config`

Sets how long the response is cached.

The value is an expiration such as `5 minutes`, or `session`. The default value is `DEF.importcache`, which is `session`.

Example: Caching for five minutes
```html
<ui-import config="url:/users.html;cache:5 minutes"></ui-import>
```

### make:path

Type: `config`

Transforms the content before the insertion.

The value is a path to a function or `plugin/method`. A `?` in the value is replaced with the `path` key. The function receives the response, the element and the `path` key, and returns the content to insert. When it returns nothing, nothing is inserted.

Example: Changing the response
```html
<ui-import config="url:/users.html;make:common.prepare"></ui-import>

<script>
    window.common = { prepare: response => response + '<u>Added</u>' };
</script>
```

### init:path

Type: `config`

Calls a function after the insertion.

The value is a path to a function or `plugin/method`. A `?` in the value is replaced with the `path` key. The function receives the element.

Example: Running code after the insertion
```html
<ui-import config="url:/users.html;init:common.ready"></ui-import>

<script>
    window.common = { ready: element => console.log(element.html()) };  // <b>Users</b>
</script>
```

### target:selector

Type: `config`

Appends the content to another element.

The value is a jQuery selector.

Example: Inserting elsewhere
```html
<ui-import config="url:/users.html;target:#box"></ui-import>
<div id="box"></div>
```

### replace:true

Type: `config`

Replaces the element with the content.

Example: Replacing the element
```html
<ui-import config="url:/users.html;replace:true"></ui-import>
```

### reevaluate:true

Type: `config`

Runs the scripts of the content on each import of the URL.

Without this key, the scripts run only the first time the URL is imported.

Example: Running scripts repeatedly
```html
<ui-import config="url:/script.html;reevaluate:true"></ui-import>
<ui-import config="url:/script.html;reevaluate:true"></ui-import>

<script>
    setTimeout(() => console.log(window.counter), 700);  // 2
</script>
```
