# SemanticsPropertyProvider

> Read-only view of semantics properties.

## API Reference

> Source set: Common

```kotlin
public interface SemanticsPropertyProvider
```

Read-only view of semantics properties.

[SemanticsConfiguration](https://composables.com/jetpack-compose/androidx.compose.ui/ui/classes/SemanticsConfiguration/api.md) implements this interface. `SemanticsNode.unmergedConfig` and
`SemanticsNode.mergedConfig` return it so that hosts can read semantics without mutating them.

## Properties

### accessibilityExtraKeys

> Source set: Common

```kotlin
public 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

> Source set: Common

```kotlin
public 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`.

## Functions

### get

> Source set: Common

```kotlin
public operator fun <T> get(key: SemanticsPropertyKey<T>): T
```

Returns the value for [key](https://composables.com/jetpack-compose/androidx.compose.ui/ui/properties/key/api.md), or throws `IllegalStateException` if not set.

#### Parameters

| | |
| --- | --- |
| key | Property key to retrieve. |

#### Return

Value associated with [key](https://composables.com/jetpack-compose/androidx.compose.ui/ui/properties/key/api.md).

#### Throws: IllegalStateException

if [key](https://composables.com/jetpack-compose/androidx.compose.ui/ui/properties/key/api.md) is not present.

### getOrElse

> Source set: Common

```kotlin
public fun <T> getOrElse(key: SemanticsPropertyKey<T>, defaultValue: () -> T): T
```

Returns the value for [key](https://composables.com/jetpack-compose/androidx.compose.ui/ui/properties/key/api.md), or runs `defaultValue` if not set.

#### Parameters

| | |
| --- | --- |
| key | Property key to retrieve. |
| defaultValue | Fallback supplier run when [key](https://composables.com/jetpack-compose/androidx.compose.ui/ui/properties/key/api.md) is not present. |

#### Return

Value associated with [key](https://composables.com/jetpack-compose/androidx.compose.ui/ui/properties/key/api.md), or the result of `defaultValue`.

### getOrElseNullable

> Source set: Common

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

Returns the value for [key](https://composables.com/jetpack-compose/androidx.compose.ui/ui/properties/key/api.md), or runs `defaultValue` if not set.

#### Parameters

| | |
| --- | --- |
| key | Property key to retrieve. |
| defaultValue | Fallback supplier run when [key](https://composables.com/jetpack-compose/androidx.compose.ui/ui/properties/key/api.md) is not present. |

#### Return

Value associated with [key](https://composables.com/jetpack-compose/androidx.compose.ui/ui/properties/key/api.md), or the result of `defaultValue`.

### contains

> Source set: Common

```kotlin
public operator fun <T> contains(key: SemanticsPropertyKey<T>): Boolean
```

Returns whether [key](https://composables.com/jetpack-compose/androidx.compose.ui/ui/properties/key/api.md) is present in this provider.

#### Parameters

| | |
| --- | --- |
| key | Property key to check. |

#### Return

`true` if [key](https://composables.com/jetpack-compose/androidx.compose.ui/ui/properties/key/api.md) is present, `false` otherwise.

### forEachProperty

> Source set: Common

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

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

#### Parameters

| | |
| --- | --- |
| action | Callback invoked with each [SemanticsPropertyKey](https://composables.com/jetpack-compose/androidx.compose.ui/ui/functions/SemanticsPropertyKey/api.md) and its associated value. |

### anyProperty

> Source set: Common

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

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

#### Parameters

| | |
| --- | --- |
| predicate | Predicate invoked with each [SemanticsPropertyKey](https://composables.com/jetpack-compose/androidx.compose.ui/ui/functions/SemanticsPropertyKey/api.md) and its associated value. |
