Instance Method

disabled(_:)

Disables the menu item.

Declaration

func disabled(_ disabled: Bool = true) -> Self

Discussion

Menu items without a onSelect handler or submenu are always disabled.

Example


MenuItem("Version 1.2.3")


MenuItem("Go Forward")
    .onSelect { ... }
    .disabled(!canGoForward)


MenuItem("Take Risky Action")
    .onSelect { ... }
    .disabled()

See Also

Behavior