> For the complete documentation index, see [llms.txt](https://docs.aurelia.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aurelia.io/developer-guides/error-messages/0088-to-0723/aur0721.md).

# AUR0721

Usage of $bindables attribute is only allowed on custom elements.

### **Error message**

Usage of $bindables is only allowed on custom element. Encountered: `<{{0}} {{1}}="{{2}}">`

### **Parameters**

1. `elementName`: The name of the standard HTML element where `$bindables` was used.
2. `attributeName`: The full attribute syntax used (e.g., `$bindables` or `$bindables.bind`).
3. `attributeValue`: The value assigned to the `$bindables` attribute.

### Error explanation

This error occurs during template compilation when the attribute named `$bindables` is used on a standard HTML element (like `<div>`, `<span>`, `<input>`, etc.) instead of an Aurelia custom element. The `$bindables` attribute, typically used with a binding command (e.g., `$bindables.bind="obj"`), is specifically designed to spread properties from an object onto the defined `@bindable` properties of an Aurelia custom element. It has no meaning and is not allowed on standard HTML elements.

Note: This is distinct from the general spread syntax `...attribute` which is also reserved. This error specifically relates to the attribute named `$bindables`.

### Common causes

* Accidentally adding the `$bindables` attribute (often with `.bind`) to a regular HTML tag instead of a custom element tag.
* Mistaking a standard HTML element for a custom element when intending to use property spreading.

### How to fix

* Remove the `$bindables` attribute from the standard HTML element.
* If you intend to spread properties onto a component, ensure the target element is a registered custom element. The correct syntax for spreading bindables is `...$bindables.bind="expression"` or simply `...$bindables="objectLiteral"`.
* If you want to bind multiple standard HTML attributes to a regular element, bind them individually (e.g., `id.bind`, `value.bind`, `class.bind`).

### Example of Incorrect Usage:

```html
<!-- Error: $bindables attribute used on a standard <div> element -->
<div $bindables.bind="myDivProperties"></div>
```

### Example of Correct Usage (on a Custom Element):

```html
<!-- my-element.html -->
<template>...</template>
```

```typescript
// my-element.ts
import { customElement, bindable } from 'aurelia';

@customElement({ name: 'my-element', template: `...` })
export class MyElement {
  @bindable prop1: string;
  @bindable prop2: number;
}

// some-other-component.ts
export class SomeOtherComponent {
  elementProperties = { prop1: 'hello', prop2: 123 };
}
```

```html
<!-- some-other-component.html -->
<import from="./my-element"></import>

<!-- Correct: Spreading bindables using ...$bindables -->
<my-element ...$bindables.bind="elementProperties"></my-element>

<!-- Also Correct: Spreading from an object literal -->
<my-element ...$bindables="{ prop1: 'Static Value', prop2: 456 }"></my-element>
```


---

# 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.aurelia.io/developer-guides/error-messages/0088-to-0723/aur0721.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.
