---
title: Bindings
description: Assigning expressions to properties.
SC: true
---

import SC from '@slint/common-files/src/components/SC.astro';

<SC>
A binding assigns an [expression](../expressions/) to a [property](../properties/#sls.prop.def) of the element in whose body it appears.
It has the form of a property name, followed by `:`, an expression, and `;`. \{#sls.binding.form}

```slint
export component Example inherits Window {
    Rectangle {
        background: #2a6e3f;
    }
}
```

The name shall refer to a property of the enclosing element. \{#sls.binding.target-must-exist}

An expression whose type is not the type of the property binds to it only when a conversion applies. \{#sls.type.conversions}

The type of the expression shall be the type of the property, or [convert](#sls.type.conversions) to it. \{#sls.binding.type}
</SC>

A binding can also hold a [code block](../statements/),
and the [`<=>` operator](../two-way-bindings/) links two properties.
