<!--
{
  "availability" : [
    "iOS: 26.4.0 -",
    "iPadOS: 26.4.0 -",
    "macCatalyst: 26.4.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 27.2.0 -",
    "visionOS: 26.4.0 -",
    "watchOS: 27.2.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/CustomizableToolbarContent/hidden(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI26CustomizableToolbarContentPAAE6hiddenyQrSbF"
  },
  "title" : "hidden(_:)"
}
-->

# hidden(_:)

Hides a toolbar item within its toolbar.

```
nonisolated func hidden(_ hidden: Bool = true) -> some CustomizableToolbarContent
```

## Parameters

`hidden`

Whether the toolbar item is hidden.

## Discussion

Use this modifier to conditionally display a toolbar item in the
toolbar. On macOS, hidden items will be displayed during user
customization.

The following example hides a downloads button when there are no
downloads, but it is displayed during customization.

```
struct ContentView {
    @State private var showDownloads = false

    var body: some View {
        BrowserView()
            .toolbar(id: "browserToolbar") {
                ToolbarItem(id: "downloads") {
                    DownloadsButton()
                }
                .hidden(!showDownloads)
            }
    }
}
```

---

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)