---
title: Component file reference
project: Flow
version: 11.1
section: development
language: en
license: MIT
url: https://totaljs.es/docs/flow/11-1/development/component-api/
updated: 2026-11-20T06:50:57.962Z
---

# Component file reference

> The exports properties and functions of the server code of a component.

The server code in `<script total>` describes the component with properties of `exports`. Flow reads the file when the component is installed. For the other parts of the file, see [The component file](../component-file/).

## API

### exports.id = 'uppercase';

Type: `property`

The id of the component inside a FlowStream.

Installing a file with an id that is already installed replaces that component. Without an id, the designer generates one. Write it on one line that ends with a semicolon.

### exports.name = 'Uppercase';

Type: `property`

The name in the list of components, on the node and in the catalogue.

Required to install the component from a URL address or a catalogue.

### exports.group = 'Demo';

Type: `property`

The group under which the designer lists the component.

### exports.icon = 'ti ti-font';

Type: `property`

The icon of the component.

A class of the Total.js icon font, for example `ti ti-print`. Required to install the component from a URL address or a catalogue.

### exports.version = '1';

Type: `property`

The version of the component, as a string.

Required to install the component from a URL address or a catalogue. The **Download components** window compares it with the version in the catalogue and shows an **update** badge when the catalogue has a higher one.

### exports.author = 'Jane Doe';

Type: `property`

The author of the component.

The catalogue copies it. An author that does not contain `Total.js` gets a **Community** badge in the **Download components** window.

### exports.color = '#E73323';

Type: `property`

A color for the icon of the component.

The catalogue copies it, and the **Download components** window uses it as the background of the icon.

### exports.kind = 'trigger';

Type: `property`

A label for the kind of component.

The official components use `trigger`, `action` and `output`. The catalogue copies it.

### exports.config = { greeting: 'Hello', uppercase: false };

Type: `property`

The default configuration of a new node.

Each node gets a copy. The settings form edits it, and `exports.make` receives it as `config`. See [Configuration and the settings form](../configuration/).

### exports.inputs = [{ id: 'input', name: 'Input' }];

Type: `property`

The inputs of the node.

Each input has an `id`, which messages report in `$.input`, and a `name`, which the node shows. See [Inputs, outputs and messages](../inputs-outputs/).

### exports.outputs = [{ id: 'output', name: 'Output' }, { id: 'error', name: 'Error' }];

Type: `property`

The outputs of the node.

Each output has an `id`, which you pass to `$.send()`, and a `name`, which the node shows. A node can change its outputs with `instance.outputs` and `instance.save()`.

### exports.npm = ['qrcode'];

Type: `property`

npm packages that the component needs.

Flow installs each package when the component is added to a FlowStream. A package can have a version, for example `mongodb@4.0.0`. Load it in `exports.make` with `require()`.

Example: Use a package
```js
exports.npm = ['qrcode'];

exports.make = function(instance, config) {
	var QRCode = require('qrcode');
};
```

### exports.meta = { singleton: true, settingswidth: 1200 };

Type: `property`

Options for the designer.

| Option | What it does |
|---|---|
| `settingswidth` | The width of the settings window in pixels. The default is `800`. |
| `singleton` | A FlowStream can hold only one node of the component. The designer refuses a second one. |
| `hidden` | The node is drawn transparent on the canvas. |
| `readonly` | The designer does not offer **Edit source code**, **Copy node** or **Clone**, and Flow refuses to read or save its source. |
| `protected` | The component cannot be removed from the FlowStream. |

### exports.make = function(instance, config) {}

Type: `event`

Creates a node.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `instance` | `Object` | yes |  | The node. See [Instance reference](../instance-api/). |
| `config` | `Object` | yes |  | The configuration of the node. It stays the same object when the user changes the settings. |

Flow calls it once for each node of the component: when the design is applied, when the FlowStream starts and when the component changes. Define the handlers of the [instance](../instance-api/) here.

Example: A component that forwards messages
```js
exports.make = function(instance, config) {
	instance.message = function($) {
		$.send('output');
	};
};
```

### exports.install = function(com) {}

Type: `event`

Runs once when the component is added to a FlowStream.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `com` | `Object` | yes |  | The component. |

Flow calls it when it registers the component for the first time in the FlowStream process, before the nodes are created. `com.main` is the FlowStream and `com.config` the default configuration.

### exports.uninstall = function(com) {}

Type: `event`

Runs when the component is removed from a FlowStream.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `com` | `Object` | yes |  | The component. |

Flow calls it after it has closed all nodes of the component.

### exports.call = function(data, callback) {}

Type: `event`

Answers a call from the browser script that is not bound to one node.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `data` | `Object` | yes |  | The data from the browser. |
| `callback` | `Function` | yes |  | Call it with the answer. |

`this` is the FlowStream. The browser script calls it with `exports.call(data, callback, true)`. The **Publish** and **Subscribe** components use it to list the nodes of other FlowStreams.

Example: Answer with the id of the FlowStream
```js
exports.call = function(data, callback) {
	callback({ flowstream: this.id });
};
```
