---
title: "Properties"
description: "Declaring properties on elements."
---

An element has a set of named *properties*, determined by the type of the element:
the element's type provides properties — including those of the base it
[inherits](../file-structure/#sls.file.component.inherits) from —
and [property declarations](#property-declaration) in the element's body add more.

A property holds a value of the property's type;
reading the property yields its current value.

## Property Declaration

A *property declaration* adds a property to the element in whose body it appears.
It consists of the keyword `property`, the type in angle brackets, and a name,
optionally preceded by a visibility modifier,
optionally followed by `:` and an expression that [binds](../bindings/) to the property,
and ends with `;`.

```slint
export component Example inherits Window {
    in property <color> tint;
    in-out property <length> gap: 10px;
}
```

The modifier declares the property's *visibility*:
which side may read and set the property's value.

An `in` property is an input of the component.

On the root element of a component the application instantiates directly, the application sets
its value through the generated API.

On any other element, the enclosing component sets its value with a binding.

An `out` property is an output of the component:
the component determines its value, and the application reads it.

An `in-out` property is both: the application sets and reads its value.

A `private` property is internal to the component:
the application can neither set nor read it.
Private is the default: a declaration without a modifier declares a private property.


Properties can be declared on any element.


Any [property type](../../property-types/) can be declared.

Without a binding, the property has the default value of its
type.

A [change callback](../callbacks/#change-callbacks) reacts to a property's value changing,
and a declaration with a [two-way binding](../two-way-bindings/) links the new property to an existing one.

A declaration may be preceded by a [`@deprecated` annotation](../deprecation/),
which marks the property as deprecated and points users at its replacement.