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

# ui-plugin

> Atribúty a konfiguračné kľúče elementu ui-plugin.

Element `<ui-plugin>` vytvorí inštanciu pluginu deklarovaného pomocou `PLUGIN()` a elementom vnútri seba dá spoločný path. Ako s ním pracovať, vysvetľuje príručka [Pluginy](../../guides/plugins/) a inštanciu opisuje stránka [Plugin](../plugin/).

## API

### path="path"

Type: `property`

Path modelu pluginu a názov deklarácie, ktorá sa má použiť.

Atribút prijíma tieto tvary:

| Hodnota | Path modelu | Deklarácia |
| --- | --- | --- |
| `orders` | `orders` | `orders` |
| `target name` | `target` | `name` |
| `? name` | vygenerovaný path pod `jComponent.data.` | `name` |
| `*` | `common` | `PLUGIN('*', ...)` |
| bez atribútu | názov ďalšej deklarácie čakajúcej na element | táto deklarácia |

Keď pre path neexistuje žiadna deklarácia, element aj tak funguje ako plugin bez vlastného kódu.

Example: Jedna deklarácia, dva modely
```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: Vygenerovaný path modelu
```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`

Konfigurácia inštancie pluginu.

Formát je rovnaký ako pri [ui-component](../ui-component/). Okrem kľúčov uvedených nižšie plugin číta z `exports.config` aj akýkoľvek vlastný kľúč.

Example: Prečítaj konfiguráciu
```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`

Zavolá funkciu pri vytvorení pluginu, tesne pred `make`.

Funkcia dostane element jQuery pluginu. Znak `?` v hodnote sa nahradí path pluginu, takže `?/ready` zavolá metódu `ready` toho istého pluginu.

Example: Zavolaj metódu pluginu
```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`

Prepne triedu CSS na elemente 500 milisekúnd po vytvorení pluginu.

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

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

### aclass:true

Type: `config`

Pridá hodnotu atribútu `path` do elementu ako triedu CSS.

Example: Štýluj plugin podľa jeho názvu
```html
<ui-plugin path="report" config="aclass:true"></ui-plugin>

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