---
title: "SemanticsPropertyKey"
description: "Creates a [SemanticsPropertyKey] that allows declaring Android-specific semantics properties
(key/value pairs set inside semantics blocks in a type-safe way) that are made available as
accessibility extras provided to accessibility services via
[android.view.accessibility.AccessibilityNodeInfo.getExtras].

Each key has one particular statically defined value type T, where T is required to be either
[Serializable] (which including boxed primitive types) or [android.os.Parcelable].

If the same property is set multiple times, the last value set in the outer modifier wins."
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-android'>Android</div>


```kotlin
fun <T> SemanticsPropertyKey(
    name: String,
    accessibilityExtraKey: String,
    mergePolicy: (T?, T) -> T? = { parentValue, _ -> parentValue },
) =
    SemanticsPropertyKey(
        name = name,
        isImportantForAccessibility = false,
        accessibilityExtraKey = accessibilityExtraKey,
        mergePolicy = mergePolicy,
    )
```


Creates a `SemanticsPropertyKey` that allows declaring Android-specific semantics properties
(key/value pairs set inside semantics blocks in a type-safe way) that are made available as
accessibility extras provided to accessibility services via
`android.view.accessibility.AccessibilityNodeInfo.getExtras`.

Each key has one particular statically defined value type T, where T is required to be either
`Serializable` (which including boxed primitive types) or `android.os.Parcelable`.

If the same property is set multiple times, the last value set in the outer modifier wins.

#### Parameters

| | |
| --- | --- |
| name | The name of the property, which should be the same as the constant from which it is accessed. |
| accessibilityExtraKey | The key used to store the value in the extras `android.os.Bundle`. |
| mergePolicy | The merge policy to use when merging descendant semantics. |




