---
title: "SemanticsNode"
description: "A list of key/value pairs associated with a layout node or its subtree.

Each SemanticsNode takes its id and initial key/value list from the outermost modifier on one
layout node. It also contains the \"collapsed\" configuration of any other semantics modifiers on
the same layout node, and if \"mergeDescendants\" is specified and enabled, also the \"merged\"
configuration of its subtree."
type: "class"
---

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


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
class SemanticsNode
internal constructor(
    internal val outerSemanticsNode: Modifier.Node,
    val mergingEnabled: Boolean,
    internal val layoutNode: LayoutNode,
    internal val unmergedConfig: SemanticsConfiguration,
)
```


A list of key/value pairs associated with a layout node or its subtree.

Each SemanticsNode takes its id and initial key/value list from the outermost modifier on one
layout node. It also contains the "collapsed" configuration of any other semantics modifiers on
the same layout node, and if "mergeDescendants" is specified and enabled, also the "merged"
configuration of its subtree.


## Properties

<div class='sourceset sourceset-common'>Common</div>


```kotlin
val layoutInfo: LayoutInfo
```


The `LayoutInfo` that this is associated with.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val root: RootForTest?
```


The `root` this node is attached to.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val id: Int
```


For newer AccessibilityNodeInfo-based integration test frameworks, it can be matched in the
extras with key "androidx.compose.ui.semantics.id"



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val touchBoundsInRoot: Rect
```


The rectangle of the touchable area.

If this is a clickable region, this is the rectangle that accepts touch input. This can be
larger than `size` when the layout is less than `ViewConfiguration.minimumTouchTargetSize`



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val size: IntSize
```


The size of the bounding box for this node, with no clipping applied



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val boundsInRoot: Rect
```


The bounding box for this node relative to the root of this Compose hierarchy, with clipping
applied. To get the bounds with no clipping applied, use Rect(`positionInRoot`,
`size`.toSize())



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val positionInRoot: Offset
```


The position of this node relative to the root of this Compose hierarchy, with no clipping
applied



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val boundsInWindow: Rect
```


The bounding box for this node relative to the window, with clipping applied. To get the
bounds with no clipping applied, use PxBounds(`positionInWindow`, `size`.toSize())



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val positionInWindow: Offset
```


The position of this node relative to the window, with no clipping applied



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val positionOnScreen: Offset
```


The position of this node relative to the screen, with no clipping applied



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val config: SemanticsConfiguration
```


The list of semantics properties of this node.

This includes all properties attached as modifiers to the current layout node. In addition,
if mergeDescendants and mergingEnabled are both true, then it also includes the semantics
properties of descendant nodes.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val children: List<SemanticsNode>
```


Contains the children in inverse hit test order (i.e. paint order).

Note that if mergingEnabled and mergeDescendants are both true, then there are no children
(except those that are themselves mergeDescendants).



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val isRoot: Boolean
```


Whether this SemanticNode is the root of a tree or not



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val parent: SemanticsNode?
```


The parent of this node in the tree.



## Functions

```kotlin
fun getAlignmentLinePosition(alignmentLine: AlignmentLine): Int
```


Returns the position of an `alignment line`, or `AlignmentLine.Unspecified` if
the line is not provided.



