---
title: "clearAndSetSemantics"
description: "Clears the semantics of all the descendant nodes and sets new semantics.

In the merged semantics tree, this clears the semantic information provided by the node's
descendants (but not those of the layout node itself, if any) and sets the provided semantics.
(In the unmerged tree, the semantics node is marked with
\"[SemanticsConfiguration.isClearingSemantics]\", but nothing is actually cleared.)

Compose's default semantics provide baseline usability for screen-readers, but this can be used
to provide a more polished screen-reader experience: for example, clearing the semantics of a
group of tiny buttons, and setting equivalent actions on the card containing them.

 Note: The [properties] lambda should be used to set semantic properties or semantic actions. Don't call [SemanticsModifierNode.applySemantics] from within the [properties] block. It will result in an infinite loop."
type: "modifier"
---

<div class='type'>Compose Modifier</div>

<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun Modifier.clearAndSetSemantics(properties: (SemanticsPropertyReceiver.() -> Unit)): Modifier
```


Clears the semantics of all the descendant nodes and sets new semantics.

In the merged semantics tree, this clears the semantic information provided by the node's
descendants (but not those of the layout node itself, if any) and sets the provided semantics.
(In the unmerged tree, the semantics node is marked with
"`SemanticsConfiguration.isClearingSemantics`", but nothing is actually cleared.)

Compose's default semantics provide baseline usability for screen-readers, but this can be used
to provide a more polished screen-reader experience: for example, clearing the semantics of a
group of tiny buttons, and setting equivalent actions on the card containing them.

 Note: The `properties` lambda should be used to set semantic properties or semantic actions. Don't call `SemanticsModifierNode.applySemantics` from within the `properties` block. It will result in an infinite loop.

#### Parameters

| | |
| --- | --- |
| properties | properties to add to the semantics. `SemanticsPropertyReceiver` will be provided in the scope to allow access for common properties and its values. |




