Founding sponsorYour name here
Finder
Mon 9:41

The pale pill behind the ★ is the highlighted state — click the icon to toggle it

Menu Bar Extra (Status Item)

/ NSStatusItem · MenuBarExtra /

also called status item, menu bar icon, menu bar app, status bar item, tray icon (Windows term)

A menu bar extra is the small icon on the right side of the macOS menu bar, next to the clock — Wi-Fi, battery, and third-party apps all live here. In AppKit it is an NSStatusItem; SwiftUI calls the whole construct a MenuBarExtra. When you click one, its button enters the highlighted state — a pale rounded background that stays visible for as long as its menu or popover is open, then fades when the menu closes.

If you called it…

the icon in the top right of the mac menu barpale background behind the menu bar icon when you click ithighlighted state when the menu bar icon's menu is openlittle icon next to the clock on macsystem tray icon on macapp icon at the top of the screen with a dropdown

…you meant a menu bar extra (status item).

Anatomy — every part, named

  1. 1
    Template iconNSImage.isTemplate

    “The monochrome icon that recolors itself” is a template icon.

  2. 2
    Highlighted stateNSStatusBarButton.isHighlighted

    “The thing behind the menu bar icon that gets highlighted” is the status button's highlighted state.

  3. 3
    Attached menu or popoverNSStatusItem.menu

    “The actual menu bar window that opens” is the status item's attached menu or popover.

Prompt — paste into your agent

Add a menu bar extra — an NSStatusItem in the macOS menu bar (SwiftUI: MenuBarExtra). While its menu or popover is open, the status item's button must show its highlighted state: the pale rounded background (NSStatusBarButton.isHighlighted), exactly like system menu bar icons.

Debug prompt — when it misbehaves

Paste this, then describe what you’re seeing — it hands your agent the classic failure modes to rule out first.

Debug my macOS menu bar extra (NSStatusItem, SwiftUI MenuBarExtra). Rule out: the status item deallocating because nothing retains it; the icon ignoring dark menu bars because the image is not marked template; the item silently hidden when the menu bar runs out of room; the button highlight sticking because isHighlighted is managed manually; MenuBarExtra window style behaving differently from menu style. The symptom:

In code

The exact names this thing goes by in code — each row is one framework’s word for it. Use the row that matches your project (or paste it into your prompt).

AppKitNSStatusItem
SwiftUIMenuBarExtramacOS 13+
AppKitNSStatusBar.system.statusItem(withLength:)how one is created
AppKitNSStatusBarButton.isHighlightedthe pale rounded background while its menu is open

See also

Search

Describe the UI element you're thinking of