---
title: "visible"
description: "A [Modifier] that controls the visibility of the Layout it is applied to. When `visible` is
`false`, the element will not be placed and thus will not be drawn or be interactable, but it
will still be measured and take up space. It will also be invisible to accessibility services.

This is similar to the `View.INVISIBLE` visibility in the classic Android View system.

Note that [Modifier.visible] is not suitable for managing the visibility of a composable involved
in a
[androidx.compose.animation.SharedTransitionScope.sharedElement]/[androidx.compose.animation.SharedTransitionScope.sharedBounds]
transition because it prevents placement."
type: "modifier"
---

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

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


```kotlin
fun Modifier.visible(visible: Boolean): Modifier
```


A `Modifier` that controls the visibility of the Layout it is applied to. When `visible` is
`false`, the element will not be placed and thus will not be drawn or be interactable, but it
will still be measured and take up space. It will also be invisible to accessibility services.

This is similar to the `View.INVISIBLE` visibility in the classic Android View system.

Note that `Modifier.visible` is not suitable for managing the visibility of a composable involved
in a
`androidx.compose.animation.SharedTransitionScope.sharedElement`/`androidx.compose.animation.SharedTransitionScope.sharedBounds`
transition because it prevents placement.

#### Parameters

| | |
| --- | --- |
| visible | `true` to make the component visible, `false` to hide it. |




## Code Examples
### VisibleModifierSample
```kotlin
@Composable
fun VisibleModifierSample() {
    Box {
        // This box will not be visible but will still occupy 50.dp x 50.dp of space.
        Box(modifier = Modifier.size(50.dp).background(Color.Red).visible(false))
    }
}
```

