# ParentLayoutParamsModifier

Artifact: [androidx.xr.compose:compose](https://developer.android.com/jetpack/androidx/releases/xr-compose) [View Source](https://cs.android.com/search?q=file:androidx/xr/compose/subspace/layout/ParentLayoutParamsModifier.kt+class:androidx.xr.compose.subspace.layout.ParentLayoutParamsModifier) Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)


```
interface ParentLayoutParamsModifier : DelegatableSubspaceNode
```

<br />

*** ** * ** ***

Interface for modifiers that can adjust the layout parameters of a composable that implements `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/ParentLayoutParamsAdjustable`.

This interface allows a parent composable to influence the layout of its children in a structured way. Implementations of this interface are responsible for determining if they can and should adjust the provided layout parameters.

When the layout system processes modifiers, if a modifier implements `ParentLayoutParamsModifier`, its `adjustParams` method will be called with an object that implements `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/ParentLayoutParamsAdjustable`. This object typically represents the layout parameters of the child composable being laid out.

```kotlin
An example modifier node that sets a specific property on TargetLayoutParams.

private class ExamplePropertySetterNode(
    private val newValue: Any? // The value to set, similar to 'alignment'
) : SomeModifierNode(), ParentLayoutParamsModifier { // Extends a base node and implements the interface

    override fun adjustParams(params: ParentLayoutParamsAdjustable) {
        // Check if 'params' is the specific type this modifier can handle.
        if (params is TargetLayoutParams) {
            // Smart cast: 'params' is now known to be TargetLayoutParams.
            // Safely access and modify its 'someProperty'.
            params.someProperty = newValue
        }
    }
}
```

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/ParentLayoutParamsModifier#adjustParams(androidx.xr.compose.subspace.layout.ParentLayoutParamsAdjustable)(params: https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/ParentLayoutParamsAdjustable)` Adjusts the given `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/ParentLayoutParamsAdjustable` object. |

### Inherited properties

From [androidx.xr.compose.subspace.layout.DelegatableSubspaceNode](https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/DelegatableSubspaceNode) `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier.Node` `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/DelegatableSubspaceNode#node()`

A reference of the `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SubspaceModifier.Node` that holds this node's position in the node hierarchy.

## Public functions

### adjustParams

Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
fun adjustParams(params: ParentLayoutParamsAdjustable): Unit
```

Adjusts the given `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/ParentLayoutParamsAdjustable` object.

Implementations **must first verify** that `params` is of an expected type before casting and modifying. This prevents runtime errors and ensures the modifier only alters parameters it understands.

| Parameters |
|---|---|
| `params: https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/ParentLayoutParamsAdjustable` | The layout parameters to potentially adjust. |