Contents

disabled(_:)

Controls whether users can interact with this tab.

Declaration

nonisolated func disabled(_ disabled: Bool) -> some TabContent<Self.TabValue>

Parameters

  • disabled:

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

Discussion

The following example shows a TabView with one tab that is not selectable.

TabView {
    Tab("Home", systemImage: "house") {
        HomeView()
    }
    Tab("Alerts", systemImage: "bell") {
        AlertsView()
    }
    .disabled(alertsDisabled)
}