---
title: Configuration and the settings form
project: Flow
version: 11.1
section: development
language: en
license: MIT
url: https://totaljs.es/docs/flow/11-1/development/configuration/
updated: 2026-11-19T10:58:44.389Z
---

# Configuration and the settings form

> Give a component default settings, a settings form, and react when the user changes them.

Every node has its own configuration. You set the default values in the component, the user changes them in the settings form, and your code reads them from `config`.

This page builds **Greeting**, which greets the name it receives with a greeting from its settings.

## Default values

`exports.config` holds the default configuration. Each new node starts with a copy of it:

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

## Read the configuration

`exports.make` receives the configuration of the node as `config`. It is the same object for the whole life of the node, and Flow updates it when the user saves the settings:

```js
exports.make = function(instance, config) {

	instance.message = function($) {
		var text = config.greeting + ', ' + $.data + '!';
		$.send('output', config.uppercase ? text.toUpperCase() : text);
	};

};
```

## React to changes

Flow calls `instance.configure` after the user changes the settings. Use it to prepare what depends on the configuration, and call it once yourself at the end of `make` for the first values:

```js
var greeting;

instance.configure = function() {
	greeting = instance.replace(config.greeting);
};

instance.configure();
```

`instance.replace` fills in variables, see [Variables in components](../variables/).

## The settings form

Write the form in `<settings>`. A field whose `path` starts with `?.` edits that key of the configuration:

```html
<settings>
	<div class="padding">
		<ui-component name="input" path="?.greeting" config="required:1" class="m">Greeting</ui-component>
		<div class="help m">You can use variables, for example <code>{welcome}</code>.</div>
		<ui-component name="input" path="?.uppercase" config="type:checkbox">Write in capital letters</ui-component>
	</div>
</settings>
```

The user opens the form by right-clicking the node and selecting **Configure**. See [Configure a node](/flow/11-1/guides/configure-nodes/).

![The settings window of a Greeting node](/files/JapyVl5GE61f.webp)

The fields are UI components of Total.js. These options of `ui-component name="input"` appear in the official components:

| `config` option | What it does |
|---|---|
| `required:1` | The field must have a value before the user can apply. |
| `type:checkbox` | A checkbox for a `true` or `false` value. |
| `type:number` | A number. Add `min:0` for a lowest value. |
| `type:multiline` | A text area. Add `height:250` for its height. |
| `dirsource:a\|A,b\|B` | A list to choose from: the value, a bar, and the label. |
| `placeholder:text` | A hint inside the empty field. |
| `monospace:1` | Shows the value in a fixed-width font. |

The settings window is 800 pixels wide. For a wider form, set `exports.meta = { settingswidth: 1200 };`.

## Show the configuration on the node

`$CONFIG` in `<body>` is the configuration of the node. This shows the greeting under the name of the node:

```html
<body>
	<header>
		<i class="$ICON"></i>$NAME
	</header>
	<footer>
		<ui-bind path="$CONFIG.greeting" config="text"></ui-bind>
	</footer>
</body>
```

## Change the configuration from code

`instance.reconfigure` changes keys of the configuration, calls `instance.configure`, shows the new values in the designer and saves them:

```js
instance.reconfigure({ uppercase: true });
```

## The whole component

```html
<script total>

	exports.id = 'greeting';
	exports.name = 'Greeting';
	exports.icon = 'ti ti-comment';
	exports.author = 'Jane Doe';
	exports.version = '1';
	exports.group = 'Demo';
	exports.config = { greeting: 'Hello', uppercase: false };
	exports.inputs = [{ id: 'input', name: 'Name' }];
	exports.outputs = [{ id: 'output', name: 'Greeting' }];

	exports.make = function(instance, config) {

		var greeting;

		instance.configure = function() {
			greeting = instance.replace(config.greeting);
		};

		// FlowStream variables and global variables have changed
		instance.variables = instance.variables2 = function() {
			instance.configure();
		};

		instance.message = function($) {
			var text = greeting + ', ' + $.data + '!';
			$.send('output', config.uppercase ? text.toUpperCase() : text);
		};

		instance.configure();
	};

</script>

<style>
	.CLASS footer { padding: 10px; font-size: 12px; }
</style>

<readme>
Greets the incoming name. The greeting can contain variables, for example `{welcome}`.
</readme>

<settings>
	<div class="padding">
		<ui-component name="input" path="?.greeting" config="required:1" class="m">Greeting</ui-component>
		<div class="help m">You can use variables, for example <code>{welcome}</code>.</div>
		<ui-component name="input" path="?.uppercase" config="type:checkbox">Write in capital letters</ui-component>
	</div>
</settings>

<body>
	<header>
		<i class="$ICON"></i>$NAME
	</header>
	<footer>
		<ui-bind path="$CONFIG.greeting" config="text"></ui-bind>
	</footer>
</body>
```

With **Greeting** set to `{welcome}` and the FlowStream variable `welcome` set to `Good morning`, a **Trigger** that sends `Jane` makes **Print** show `Good morning, Jane!`. With **Write in capital letters** on, it shows `GOOD MORNING, JANE!`.

![Trigger, Greeting and Print, with Good morning, Jane! in the Print node](/files/JapyVn5HE60f.webp)
