# error-message

**Optional**

**Type:** `string`

**Default**: An error message that relates to the bound input

Override the default error message when the input component is validated.

{% hint style="info" %}
**Remember to use `required="true"`**

The overridden error message will only be used when the input component is marked as required. I.e. `required="true"`
{% endhint %}

#### Example - `error-message` on a `text-input`

{% code title="main.view\.xml" %}

```xml
<var name="username" type="text"/>

<text-input bind="username" required="true" error-message="You must enter a username"/>
```

{% endcode %}

![](https://2865107717-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9TCHLR67eLHBOjPvHhud%2Fuploads%2Fgit-blob-22066a435119eebecdd3b48f9e00ceddbc653fe1%2Ftext-input-error-message.png?alt=media)
