Mac Catalyst: disabled SwiftUI toolbar buttons turn into pills and don’t update their state

Hi everyone,

we’ve been fighting with disabled toolbar buttons in our Mac Catalyst app and wanted to check whether others are seeing the same thing, or whether we’re missing something.

Our toolbar lives in a SwiftUI NavigationStack, so Catalyst bridges it into the window’s NSToolbar. Enabled buttons look and work great: native buttons with a round 36 × 36 pt glass. But as soon as a button uses .disabled(_:), things fall apart:

  • It turns into a wider pill. A button that is disabled when it appears becomes an image item instead of a button (NSToolbarImageView with a UIImage), and its glass grows to 47 × 36 pt.
  • Its state doesn’t update. Toggling .disabled(_:) doesn’t reach the existing toolbar item. It only changes if we give the ToolbarItem a new id, which then brings back the pill.
  • Disabling the NSToolbarItem ourselves doesn’t stick. UIKit revalidates the toolbar whenever any item changes, and copies the bar button’s enabled state back over ours.
  • Drawing our own image to fix the shape crashed AppKit (“Unable to install constraint on view”) as soon as the item switched back to enabled.

For now we keep the SwiftUI button enabled on the Mac and disable the native NSToolbarItem ourselves. We find the toolbar via NSToolbar.willAddItemNotification and use KVO to put the state back whenever UIKit overrides it. It works, but it feels like it shouldn’t be necessary.

Here’s a minimal example:

struct ContentView: View {
  @State private var canUndo = false
  var body: some View {
    NavigationStack {
        Button("Toggle") { canUndo.toggle() }
            .toolbar {
                ToolbarItem(placement: .topBarLeading) {
                    Button("Undo", systemImage: "arrow.uturn.backward") {}
                        .labelStyle(.iconOnly)
                        .disabled(!canUndo)
                    }
                }
         }
    }
}

Seen on macOS 27.2 and 26.7.1, Xcode 27.2. Filed as FB25597608.

Is there a supported way to get a disabled toolbar button that stays a normal native button? Any hints are very welcome. Thanks!