Spanish Total.js
English
Documentation For AI agents
Contents

Component declaration reference

Every property that the script of a component declares on exports.

.md GitHub
On this page

The <script> of editor.html and render.html declares the component on exports. editor.html needs at least id, name and make; render.html needs id and make.

exports.id = 'greeting';
exports.name = 'Greeting';
exports.group = 'Demo';
exports.author = 'Jane Doe';
exports.icon = 'ti ti-comment';
exports.version = '1';
exports.config = { text: 'Hello, world!' };
exports.render = 'auto';
exports.settings = 'auto';

exports.make = function(instance, config, element, cls, iseditor) {
};

API

property

exports.id = 'greeting';

The id of the component.

Use lowercase letters and digits. The id names the component in the design and in the catalogue, and it is the name of its folder. An instance of the component has the class ui_ and the id.

property

exports.name = 'Greeting';

The name in the component list.

A new instance gets it as its Name.

property

exports.group = 'Demo';

The group in the component list of the editor.
property

exports.icon = 'ti ti-comment';

The icon in the component list, a Total.js icon class.
property

exports.author = 'Jane Doe';

The author of the component.
property

exports.version = '1';

The version of the component, as a string.

Raise it with every change of a component you share.

property

exports.color = '#6C5CE7';

A colour of the component, kept in the catalogue and in the lists of inputs and outputs.
property

exports.config = { text: 'Hello, world!' };

The default configuration of a new instance.

Each instance gets a copy. See Settings and the settings form.

delegate

exports.make = function(instance, config, element, cls, iseditor) {}

Builds one instance.
ParameterTypeDescription
instance Object The instance. See Instance reference.
config Object The configuration of the instance, the same object as instance.config.
element jQuery The element of the instance.
cls String The class name of the component, the word that replaces CLASS.
iseditor Boolean true in the editor, undefined in a published design.

UI Builder calls it once for each instance, in the editor with the code of editor.html and in a published design with the code of render.html.

property

exports.render = 'auto';

Where the code for the published design is.

'auto' means render.html next to editor.html. It can also be the address of a file. Without it, the published design uses the code of editor.html.

property

exports.settings = 'auto';

Where the settings form is.

'auto' means settings.html next to editor.html. It can also be the address of a file, or the HTML of the form itself.

property

exports.inputs = [{ id: 'set', name: 'Set value' }];

The inputs of the component.

Each item has an id and a name, and can have a note. Declare them in both files. See Inputs and outputs.

property

exports.outputs = [{ id: 'change', name: 'Change' }];

The outputs of the component.

Each item has an id and a name, and can have a note. instance.output() looks the id up here, so declare them in render.html too.

property

exports.follow = true;

Lists every instance in Read value from of other components, as @ and its id.

Other components can then follow its value. See Values and data binding.

property

exports.import = ['https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.8.0/leaflet.min.js'];

Scripts and styles to load before the instances are built.

Each address is loaded once. See Styles and libraries.

property

exports.type = ['app', 'dashboard'];

The kinds of design that offer the component in the catalogue.

The catalogue copies it, and Import components shows the component only in designs of these types. See Your own catalogue.

property

exports.floating = true;

Places instances freely on the canvas instead of in a container.

The instance is positioned with left, top and z-index, which the design saves. The user moves it with the mouse and changes its order with Bring to front and Bring to back. Marker of the Flowboard template is floating.

property

exports.hidden = true;

Hides the component in the component list.

Use it for a component that a template adds, such as Floor plan.

property

exports.scope = true;

Marks a component that handles the components inside it on its own, such as a form.

instance.family() of a parent does not go into the instances inside it.

property

exports.children = [[ ... ]];

Components that every instance brings inside it.

An array of areas, each an array of instances as in a design file. Export to component writes it. See Containers.

property

exports.components = { textbox: 'https://cdn.componentator.com/uibuilder/textbox/editor.html' };

Other components that this component needs.

UI Builder loads those the design does not have yet. Each value is an address or a component source.

delegate

exports.uninstall = function() {}

Runs when the design is removed from the page, to clean up.
Made in Europe