3

I would like to make a menu button red as it carries a destructive nature, but my implementation doesn't override the foreground color at all.

Code.

ToolbarItem(placement: .navigationBarTrailing) {
    Menu {
        Button(action: {}) {
           Label("Delete", systemImage: "trash")
               .foregroundColor(.red)
        }
    }
    label: {
        Text("Next")
    }
}

Other attempts:

ToolbarItem(placement: .navigationBarTrailing) {
    Menu {
        Button(action: {}) {
           Label("Delete", systemImage: "trash")
        }
        .foregroundColor(.red)
    }
    label: {
        Text("Next")
    }
}

Results

enter image description here

Noticed that the "Delete" button is not red.

Koh
  • 2,687
  • 1
  • 22
  • 62

0 Answers0