# required

**Optional**

**Type:** `boolean`

**Default**: `false`

Specifies whether a value must be entered/selected when the view is validated (e.g. via a `validate="true"` attribute on a button or an action). Can be either `true`, `false`, or the result of a function, e.g. `$:shouldBeRequired()`.

{% hint style="info" %}
**Required component with a label**

A component with a [`label`](https://docs.journeyapps.com/reference/build/ui-components/xml-fields/label) set and `required="true"` will automatically add an asterisk `*` to the right of the `label` text.
{% endhint %}
