---
title: Inputs and outputs
project: UI Builder
version: 1.0
section: development
language: en
license: MIT
url: https://totaljs.es/docs/uibuilder/1-0/development/inputs-outputs/
updated: 2026-11-19T11:56:06.259Z
---

# Inputs and outputs

> Let the app that shows a design send data into your component and receive data from it.

Inputs and outputs connect a design to the app that shows it. An input receives data from the app. An output sends data to it. UI Builder lists them in **Inputs / Outputs** for every instance of your component. See [Inputs and outputs](/uibuilder/1-0/guides/inputs-outputs/).

## Declare them

Declare the inputs and outputs in `editor.html`, for the list in the editor, and in `render.html`, for the published design:

```js
exports.inputs = [{ id: 'set', name: 'Set value' }];
exports.outputs = [{ id: 'change', name: 'Change' }];
```

The id of an input or output in the design is the id of the instance, `_` and the id you declare, for example `cid6wh0tx52_set`.

![Inputs / Outputs with the inputs and outputs of a Form and two Steppers](/files/Jaq7Le6Bs60f.webp)

## Handle an input

```js
instance.input('set', function(data, callback) {
	instance.set('value', +data);
});
```

The function receives the data and a callback. The app sends data with `app.input()`:

```js
app.input('cid6wh0tx52_set', 2, function(err) {
	// err is 'Input "..." not found' when there is no such input
});
```

## Send an output

Pass the data to send it at once:

```js
instance.output('change', value);
```

Or register a function and call the output without data. UI Builder calls your function with `next`, and you send the result with `next(err, data)`. **Form** sends its data this way:

```js
instance.output('submit', function(next) {
	next(null, instance.get());
});

instance.output('submit');
```

## Receive outputs in the app

The app that shows the design listens to the outputs of all instances:

```js
app.on('output', function(meta) {
	// meta.id      'cid6wh0tx52_change'
	// meta.ref     'change'
	// meta.data    the data
	// meta.err     the error, or null
	// meta.instance, meta.component, meta.app
});
```

`UIBuilder.on('output', fn)` receives the outputs of every design on the page. See [App reference](../app-api/).

## Outputs of one instance

To give each instance its own outputs, for example one for each button the user adds, set `instance.outputs` to an array like `exports.outputs`. The editor lists those, and `instance.output()` uses them. **App Layout** does this for its buttons.

## Send data to an input from a component

A component can send data to an input of the same design with `instance.app.input(id, data)`. **Button** uses the input the user picks in its settings, from a field with `dirsource:#inputs`.
