> For the complete documentation index, see [llms.txt](https://docs.decentraland.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decentraland.org/creator/content-creator-es/scenes-sdk7/ui-2d/ui_input_binding.md).

# Vinculación de entrada de UI

Vincula acciones de entrada a tus propios elementos de UI para que controlen la entrada del jugador.

`UiInputBinding` convierte cualquier elemento de la UI en un botón de control. Vincula un elemento a uno o varios [`InputAction`](https://docs.decentraland.org/creator/content-creator-es/scenes-sdk7/interactividad/eventos-de-button/click-events.md#pointer-buttons) y, mientras se mantiene pulsado —con el tacto o el puntero—, esas acciones permanecen activas y controlan tanto la entrada del jugador local (movimiento, salto) como cualquier listener de la escena, [`InputAction`](https://docs.decentraland.org/creator/content-creator-es/scenes-sdk7/interactividad/eventos-de-button/click-events.md#pointer-buttons) exactamente igual que los botones nativos en pantalla.

Úsalo para crear tus propios controles táctiles. Normalmente se combina con [Controles en pantalla](https://docs.decentraland.org/creator/content-creator-es/scenes-sdk7/interactividad/touch-screen-controls.md): oculta los botones nativos y coloca los tuyos en su lugar.

<figure><img src="https://1216664193-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-9124ebe50a4d4cd7ceae7b8f11b6efb34c6e25d8%2Fui-input-binding.webp?alt=media" alt="A retro-style gamepad assembled from custom UI elements, each wired to an input action"><figcaption><p>Un gamepad totalmente personalizado creado con elementos de la UI: cada botón es una entidad de UI vinculada a una acción de entrada</p></figcaption></figure>

## Vincular una acción a un elemento de la UI

Añade una prop `uiInputBinding` a cualquier elemento de tu UI `.tsx` y enumera las acciones que se deben mantener mientras esté pulsado. La prop está disponible en todos los elementos de la UI ([`UiEntity`](https://docs.decentraland.org/creator/content-creator-es/scenes-sdk7/ui-2d/onscreen-ui.md#ui-entities), [`Button`](https://docs.decentraland.org/creator/content-creator-es/scenes-sdk7/ui-2d/onscreen-ui.md#ui-entities), [`Label`](https://docs.decentraland.org/creator/content-creator-es/scenes-sdk7/ui-2d/onscreen-ui.md#ui-entities), …), igual que `uiTransform` y `uiBackground`.

**Un botón que mueve al jugador hacia delante mientras se mantiene pulsado:**

```tsx
import { InputAction } from '@dcl/sdk/ecs'
import { Button } from '@dcl/sdk/react-ecs'

export const forwardButton = () => (
	<Button
		value="▲"
		uiTransform={{ width: 100, height: 100 }}
		uiInputBinding={{ actions: [InputAction.IA_FORWARD] }}
	/>
)
```

## Crear un grupo de controles personalizado

Combina varios elementos vinculados para armar un esquema de controles completo.

**Un botón de movimiento y otro de acción que activa `IA_PRIMARY`:**

```tsx
import { InputAction } from '@dcl/sdk/ecs'
import { Button, UiEntity } from '@dcl/sdk/react-ecs'

export const customControls = () => (
	<UiEntity uiTransform={{ width: 240, height: 120 }}>
		<Button
			value="▲"
			uiTransform={{ width: 100, height: 100 }}
			uiInputBinding={{ actions: [InputAction.IA_FORWARD] }}
		/>
		<Button
			value="Use"
			uiTransform={{ width: 100, height: 100 }}
			uiInputBinding={{ actions: [InputAction.IA_PRIMARY] }}
		/>
	</UiEntity>
)
```

Las acciones vinculadas funcionan igual que los botones nativos: `IA_FORWARD` / `IA_BACKWARD` / `IA_LEFT` / `IA_RIGHT` mueven al Avatar, y tu escena puede leer cualquier acción mediante sus [`InputAction`](https://docs.decentraland.org/creator/content-creator-es/scenes-sdk7/interactividad/eventos-de-button/click-events.md#pointer-buttons) listeners. Al quitar la prop (o el componente), se libera la vinculación.

## Propiedades

| Propiedad | Tipo                                                                                                                                                            | Descripción                                                                                                                                                                                                                                                                                                                                                                                                                           |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `actions` | array de [`InputAction`](https://docs.decentraland.org/creator/content-creator-es/scenes-sdk7/interactividad/eventos-de-button/click-events.md#pointer-buttons) | Las acciones de entrada que se mantienen pulsadas mientras se presiona este elemento. Consulta [Eventos de clic](https://docs.decentraland.org/creator/content-creator-es/scenes-sdk7/interactividad/eventos-de-button/click-events.md) para ver la lista completa de [`InputAction`](https://docs.decentraland.org/creator/content-creator-es/scenes-sdk7/interactividad/eventos-de-button/click-events.md#pointer-buttons) valores. |

{% hint style="info" %}
Combina esto con [`TouchScreenControls`](https://docs.decentraland.org/creator/content-creator-es/scenes-sdk7/interactividad/touch-screen-controls.md) para ocultar los controles nativos y sustituirlos por tu propia UI táctil: la forma recomendada de ofrecer un esquema de controles totalmente personalizado.
{% endhint %}

## Relacionado

* [Controles en pantalla](https://docs.decentraland.org/creator/content-creator-es/scenes-sdk7/interactividad/touch-screen-controls.md)
* [Eventos de botones de UI](https://docs.decentraland.org/creator/content-creator-es/scenes-sdk7/ui-2d/ui_button_events.md)
* [Entrada en dispositivos móviles](https://docs.decentraland.org/creator/content-creator-es/desarrollar-para-movil/desarrollar/input-on-mobile.md)
* [Eventos de clic](https://docs.decentraland.org/creator/content-creator-es/scenes-sdk7/interactividad/eventos-de-button/click-events.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.decentraland.org/creator/content-creator-es/scenes-sdk7/ui-2d/ui_input_binding.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
