<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/hidden()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE6hiddenQryF"
  },
  "title" : "hidden()"
}
-->

# hidden()

Hides this view unconditionally.

```
nonisolated func hidden() -> some View
```

## Return Value

A hidden view.

## Discussion

Hidden views are invisible and can’t receive or respond to interactions.
However, they do remain in the view hierarchy and affect layout. Use
this modifier if you want to include a view for layout purposes, but
don’t want it to display.

```
HStack {
    Image(systemName: "a.circle.fill")
    Image(systemName: "b.circle.fill")
    Image(systemName: "c.circle.fill")
        .hidden()
    Image(systemName: "d.circle.fill")
}
```

The third circle takes up space, because it’s still present, but
SwiftUI doesn’t draw it onscreen.

![A row of circles with the letters A, B, and D, with a gap where](images/com.apple.SwiftUI/SwiftUI-View-hidden-1@2x.png)

If you want to conditionally include a view in the view hierarchy, use
an `if` statement instead:

```
VStack {
    HStack {
        Image(systemName: "a.circle.fill")
        Image(systemName: "b.circle.fill")
        if !isHidden {
            Image(systemName: "c.circle.fill")
        }
        Image(systemName: "d.circle.fill")
    }
    Toggle("Hide", isOn: $isHidden)
}
```

Depending on the current value of the `isHidden` state variable in the
example above, controlled by the [`Toggle`](/documentation/SwiftUI/Toggle) instance, SwiftUI draws
the circle or completely omits it from the layout.

![Two side by side groups of items, each composed of a toggle beneath](images/com.apple.SwiftUI/SwiftUI-View-hidden-2@2x.png)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)