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

# ui-plugin

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

The `<ui-plugin>` element creates an instance of a plugin declared with `PLUGIN()` and gives the elements inside it a common path. The [Plugins](../../guides/plugins/) guide explains how to work with it, and the instance is described on the [Plugin](../plugin/) page.

## API

### path="path"

Type: `property`

The path of the plugin model, and the name of the declaration to use.

The attribute accepts these forms:

| Value | Model path | Declaration |
| --- | --- | --- |
| `orders` | `orders` | `orders` |
| `target name` | `target` | `name` |
| `? name` | a generated path under `jComponent.data.` | `name` |
| `*` | `common` | `PLUGIN('*', ...)` |
| no attribute | the name of the next declaration waiting for an element | that declaration |

When no declaration exists for the path, the element still works as a plugin without its own code.

Example: One declaration, two models
```html
<ui-plugin path="left counter"></ui-plugin>
<ui-plugin path="right counter"></ui-plugin>

<script>
PLUGIN('counter', function(exports) {
    exports.make = function() {
        console.log(exports.name);
    };
});
// logs: left
// logs: right
</script>
```

Example: A generated model path
```html
<ui-plugin path="? counter"></ui-plugin>

<script>
PLUGIN('counter', function(exports) {
    exports.make = function() {
        console.log(exports.name.substring(0, 16));
    };
});
// logs: jComponent.data.
</script>
```

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

Type: `property`

The configuration of the plugin instance.

The format is the same as in [ui-component](../ui-component/). Besides the keys below, the plugin reads any key of its own from `exports.config`.

Example: Read the configuration
```html
<ui-plugin path="report" config="limit:20"></ui-plugin>

<script>
PLUGIN('report', 'limit:5;sort:name', function(exports, config) {
    console.log(config.limit, config.sort);
});
// logs: 20 name
</script>
```

### init:path

Type: `config`

Calls a function when the plugin is created, just ahead of `make`.

The function receives the jQuery element of the plugin. A `?` in the value is replaced with the path of the plugin, so `?/ready` calls the `ready` method of the same plugin.

Example: Call a method of the plugin
```html
<ui-plugin path="report" config="init:?/ready"></ui-plugin>

<script>
PLUGIN('report', function(exports) {
    exports.ready = function(element) {
        console.log(element[0].tagName);
    };
});
// logs: UI-PLUGIN
</script>
```

### class:name

Type: `config`

Toggles a CSS class on the element 500 milliseconds after the plugin is created.

Example: Reveal the plugin
```html
<ui-plugin path="report" config="class:visible"></ui-plugin>

<script>
PLUGIN('report', function(exports) {});
</script>
```

### aclass:true

Type: `config`

Adds the value of the `path` attribute to the element as a CSS class.

Example: Style the plugin by its name
```html
<ui-plugin path="report" config="aclass:true"></ui-plugin>

<script>
PLUGIN('report', function(exports) {});
</script>
```
