<!--
{
  "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/disabled(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE8disabledyQrSbF"
  },
  "title" : "disabled(_:)"
}
-->

# disabled(_:)

Adds a condition that controls whether users can interact with this
view.

```
nonisolated func disabled(_ disabled: Bool) -> some View
```

## Parameters

`disabled`

A Boolean value that determines whether users can
interact with this view.

## Return Value

A view that controls whether users can interact with this
view.

## Discussion

The higher views in a view hierarchy can override the value you set on
this view. In the following example, the button isn’t interactive
because the outer `disabled(_:)` modifier overrides the inner one:

```
HStack {
    Button(Text("Press")) {}
    .disabled(false)
}
.disabled(true)
```

---

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)