---
title: "interactionBarrier"
description: "Declares that this component blocks touch/pointer input and screen reader accessibility for elements geometrically behind it."
type: "modifier"
lastmod: "2026-09-24"
---
## API Reference

### interactionBarrier

> Source set: Common

```kotlin
public fun Modifier.interactionBarrier(): Modifier
```

Declares that this component blocks touch/pointer input and screen reader accessibility for
elements geometrically behind it.

## Code Examples

### InteractionBarrierSample

```kotlin
@Sampled
@Composable
fun InteractionBarrierSample() {
    var showDialog by remember { mutableStateOf(false) }

    Box(Modifier.fillMaxSize()) {
        // Background button on the main screen (opens dialog, blocked while dialog is visible)
        Button(onClick = { showDialog = true }, modifier = Modifier.align(Alignment.Center)) {
            Text("Open Dialog")
        }

        // Custom modal dialog overlay using Modifier.interactionBarrier()
        if (showDialog) {
            Box(
                modifier =
                    Modifier.fillMaxSize()
                        .background(Color.Black.copy(alpha = 0.5f))
                        .interactionBarrier(),
                contentAlignment = Alignment.Center,
            ) {
                Card(modifier = Modifier.padding(24.dp)) {
                    Column(
                        modifier = Modifier.padding(16.dp),
                        horizontalAlignment = Alignment.CenterHorizontally,
                    ) {
                        Text("Custom Dialog", style = MaterialTheme.typography.headlineSmall)
                        Spacer(Modifier.height(8.dp))
                        Text("Background interaction is blocked by the barrier.")
                        Spacer(Modifier.height(16.dp))
                        Button(onClick = { showDialog = false }) { Text("Close Dialog") }
                    }
                }
            }
        }
    }
}
```
