# SemanticsPropertyKey

# SemanticsPropertyKey

Artifact:[androidx.glance:glance](https://developer.android.com/jetpack/androidx/releases/glance)  
[View Source](https://cs.android.com/search?q=file:androidx/glance/semantics/SemanticsProperties.kt+class:androidx.glance.semantics.SemanticsPropertyKey)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/glance#1.0.0)

<br />

```
class SemanticsPropertyKey<T : Any?>
```

<br />

*** ** * ** ***

SemanticsPropertyKey is the infrastructure for setting key/value pairs inside semantics block in a type-safe way. Each key has one particular statically defined value type T.

## Summary

|                                                                                                                                                                                   ### Public constructors                                                                                                                                                                                    |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `<T : `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?> `[SemanticsPropertyKey](https://developer.android.com/reference/kotlin/androidx/glance/semantics/SemanticsPropertyKey#SemanticsPropertyKey(kotlin.String,kotlin.Function2))`(name: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`, mergePolicy: (T, T?) `->` T?)` |

| ### Public functions |
|----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `T?`                 | [merge](https://developer.android.com/reference/kotlin/androidx/glance/semantics/SemanticsPropertyKey#merge(kotlin.Any,kotlin.Any))`(parentValue: T?, childValue: T)` |

|                               ### Public properties                               |
|-----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) | [name](https://developer.android.com/reference/kotlin/androidx/glance/semantics/SemanticsPropertyKey#name()) The name of the property. |

## Public constructors

### SemanticsPropertyKey

```
<T : Any?> SemanticsPropertyKey(
    name: String,
    mergePolicy: (T, T?) -> T? = { parentValue, childValue ->
        parentValue ?: childValue
    }
)
```  

## Public functions

### merge

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/glance#1.0.0)  

```
fun merge(parentValue: T?, childValue: T): T?
```  

## Public properties

### name

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/glance#1.0.0)  

```
val name: String
```

The name of the property. Should be the same as the constant from shich it is accessed.