> Documentation index: https://developer.android.com/reference/llms.txt

# SemanticsPropertyProvider

Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/semantics/SemanticsConfiguration.kt+class:androidx.compose.ui.semantics.SemanticsPropertyProvider) Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01) Common/AllAndroid/JVM
- Cmn

  ```
  @ExperimentalComposeUiHostApi
  interface SemanticsPropertyProvider
  ```
Known direct subclasses [SemanticsConfiguration](https://developer.android.com/reference/kotlin/androidx/compose/ui/semantics/SemanticsConfiguration.md.txt)

|---|---|
| `SemanticsConfiguration` | Describes the semantic information associated with the owning component |

*** ** * ** ***

Read-only view of semantics properties.

`SemanticsConfiguration` implements this interface. `SemanticsNode.unmergedConfig` and `SemanticsNode.mergedConfig` return it so that hosts can read semantics without mutating them.

## Summary

| ### Public functions |
|---|---|---|
| `Boolean` | `anyProperty(predicate: (key: SemanticsPropertyKey<*>, Any?) -> Boolean)` Returns `true` if at least one property in this provider matches `predicate`. | Cmn |
| `operator Boolean` | `<T : Any?> contains(key: SemanticsPropertyKey<T>)` Returns whether `key` is present in this provider. | Cmn |
| `Unit` | `forEachProperty(action: (key: SemanticsPropertyKey<*>, Any?) -> Unit)` Invokes `action` for each property key and value in this provider. | Cmn |
| `operator T` | `<T : Any?> get(key: SemanticsPropertyKey<T>)` Returns the value for `key`, or throws `IllegalStateException` if not set. | Cmn |
| `T` | `<T : Any?> getOrElse(key: SemanticsPropertyKey<T>, defaultValue: () -> T)` Returns the value for `key`, or runs `defaultValue` if not set. | Cmn |
| `T?` | `<T : Any?> getOrElseNullable( key: SemanticsPropertyKey<T>, defaultValue: () -> T? )` Returns the value for `key`, or runs `defaultValue` if not set. | Cmn |

| ### Public properties |
|---|---|---|
| `Set<SemanticsPropertyKey<*>>` | `accessibilityExtraKeys` Keys in this provider whose `SemanticsPropertyKey.accessibilityExtraKey` is non-null. | Cmn |
| `Boolean` | `isMergingSemanticsOfDescendants` Whether this configuration declares that it merges the semantics of its descendants (`Modifier.semantics(mergeDescendants = true)`). | Cmn |

| ### Extension functions |
|---|---|---|
| `T?` | `@ExperimentalComposeUiHostApi <T : Any?> SemanticsPropertyProvider.getOrNull( key: SemanticsPropertyKey<T> )` Returns the value for `key`, or `null` if not present. | Cmn |
| `Boolean` | `@ExperimentalComposeUiHostApi SemanticsPropertyProvider.hasKeysMissingFrom( other: SemanticsPropertyProvider )` Returns `true` if this provider contains at least one key that `other` does not contain. | Cmn |

## Public functions

### anyProperty

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
fun anyProperty(predicate: (key: SemanticsPropertyKey<*>, Any?) -> Boolean): Boolean
```

Returns `true` if at least one property in this provider matches `predicate`. Stops at the first match.

| Parameters |
|---|---|
| `predicate: (key: SemanticsPropertyKey<*>, Any?) -> Boolean` | Predicate invoked with each `SemanticsPropertyKey` and its associated value. |

### contains

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
operator fun <T : Any?> contains(key: SemanticsPropertyKey<T>): Boolean
```

Returns whether `key` is present in this provider.

| Parameters |
|---|---|
| `key: SemanticsPropertyKey<T>` | Property key to check. |

| Returns |
|---|---|
| `Boolean` | `true` if `key` is present, `false` otherwise. |

### forEachProperty

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
fun forEachProperty(action: (key: SemanticsPropertyKey<*>, Any?) -> Unit): Unit
```

Invokes `action` for each property key and value in this provider.

| Parameters |
|---|---|
| `action: (key: SemanticsPropertyKey<*>, Any?) -> Unit` | Callback invoked with each `SemanticsPropertyKey` and its associated value. |

### get

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
operator fun <T : Any?> get(key: SemanticsPropertyKey<T>): T
```

Returns the value for `key`, or throws `IllegalStateException` if not set.

| Parameters |
|---|---|
| `key: SemanticsPropertyKey<T>` | Property key to retrieve. |

| Returns |
|---|---|
| `T` | Value associated with `key`. |

| Throws |
|---|---|
| `IllegalStateException` | if `key` is not present. |

### getOrElse

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
fun <T : Any?> getOrElse(key: SemanticsPropertyKey<T>, defaultValue: () -> T): T
```

Returns the value for `key`, or runs `defaultValue` if not set.

| Parameters |
|---|---|
| `key: SemanticsPropertyKey<T>` | Property key to retrieve. |
| `defaultValue: () -> T` | Fallback supplier run when `key` is not present. |

| Returns |
|---|---|
| `T` | Value associated with `key`, or the result of `defaultValue`. |

### getOrElseNullable

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
fun <T : Any?> getOrElseNullable(
    key: SemanticsPropertyKey<T>,
    defaultValue: () -> T?
): T?
```

Returns the value for `key`, or runs `defaultValue` if not set.

| Parameters |
|---|---|
| `key: SemanticsPropertyKey<T>` | Property key to retrieve. |
| `defaultValue: () -> T?` | Fallback supplier run when `key` is not present. |

| Returns |
|---|---|
| `T?` | Value associated with `key`, or the result of `defaultValue`. |

## Public properties

### accessibilityExtraKeys

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
val accessibilityExtraKeys: Set<SemanticsPropertyKey<*>>
```

Keys in this provider whose `SemanticsPropertyKey.accessibilityExtraKey` is non-null.

Hosts expose these values as accessibility extras. Returns an empty set if there are none.

### isMergingSemanticsOfDescendants

Cmn Added in [1.14.0-alpha01](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt#1.14.0-alpha01)

```
val isMergingSemanticsOfDescendants: Boolean
```

Whether this configuration declares that it merges the semantics of its descendants (`Modifier.semantics(mergeDescendants = true)`).

This is the declared value only. `SemanticsNode.isMergingSemanticsOfDescendants` is `true` only when this value is `true` **and** the node was created with `SemanticsNode.mergingEnabled`.

## Extension functions

### SemanticsPropertyProvider.getOrNull

Cmn Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/semantics/SemanticsConfiguration.kt+function:getOrNull)

```
@ExperimentalComposeUiHostApi
fun <T : Any?> SemanticsPropertyProvider.getOrNull(
    key: SemanticsPropertyKey<T>
): T?
```

Returns the value for `key`, or `null` if not present.

| Parameters |
|---|---|
| `key: SemanticsPropertyKey<T>` | Property key to retrieve. |

| Returns |
|---|---|
| `T?` | Value associated with `key`, or `null` if not present. |

### SemanticsPropertyProvider.hasKeysMissingFrom

Cmn Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui.md.txt) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/semantics/SemanticsConfiguration.kt+function:hasKeysMissingFrom)

```
@ExperimentalComposeUiHostApi
fun SemanticsPropertyProvider.hasKeysMissingFrom(
    other: SemanticsPropertyProvider
): Boolean
```

Returns `true` if this provider contains at least one key that `other` does not contain.

Use this to detect deleted properties between an old and a new configuration of the same node: `oldConfig.hasKeysMissingFrom(newConfig)`. Values are not compared.

| Parameters |
|---|---|
| `other: SemanticsPropertyProvider` | The provider to check keys against. |