---
title: Deprecated Properties
description: Experimental @deprecated annotation for property declarations.
---

The `@deprecated` annotation marks a property declaration as deprecated.
Whenever the property is accessed from outside the component that declares it, the compiler emits a warning that points to the replacement.
This lets a component evolve its public API while giving users a migration path instead of a hard break.

> **Note**: `@deprecated` is experimental and subject to change.

## Syntax

Prefix a property declaration with `@deprecated`.
Without an argument, the property must have a two-way binding whose target is a public property of the same element, and the replacement is derived from that target:

```slint no-test
@deprecated in-out property <int> old-prop <=> new-prop;
```

An access to `old-prop` then warns with `Please use 'new-prop' instead`.

Pass a string literal to provide a custom message when there is no single replacement property:

```slint no-test
@deprecated("Compute it from 'new-prop' instead") in-out property <int> older-prop: 42;
```

## Example

```slint
component Inner {
    in-out property <int> new-prop;
    @deprecated in-out property <int> old-prop <=> new-prop;

    // No warning: accesses within the declaring component are fine.
    in-out property <int> internal: old-prop;
}

export component Example {
    inner := Inner {
        new-prop: 42;
    }

    // Warning: The property 'old-prop' has been deprecated. Please use 'new-prop' instead
    property <int> value: inner.old-prop;
}
```

## Rules

- `@deprecated` can only be applied to property declarations.
- Without a message, the declaration must use a two-way binding (`<=>`) whose target is a public property of the same element, so the replacement can be derived and reached by callers. Otherwise, provide an explicit message.
- The message must be a plain string literal, without any `\{}` expressions.
- Accessing a deprecated property is only a warning, never an error, so existing code keeps compiling.
- Accesses from within the declaring component do not warn, since that component still needs to implement the property.
