<!--
{
  "availability" : [
    "macOS: 10.12.0 - 10.13.0"
  ],
  "documentType" : "symbol",
  "framework" : "SafariServices",
  "identifier" : "/documentation/SafariServices/SFSafariToolbarItem/setEnabled(_:withBadgeText:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Safari Services"
    ],
    "preciseIdentifier" : "c:objc(cs)SFSafariToolbarItem(im)setEnabled:withBadgeText:"
  },
  "title" : "setEnabled(_:withBadgeText:)"
}
-->

# setEnabled(_:withBadgeText:)

Sets the enabled state and the badge text for the toolbar item.

```
func setEnabled(_ enabled: Bool, withBadgeText badgeText: String?)
```

## Parameters

`enabled`

<doc://com.apple.documentation/documentation/Swift/true> to enable the toolbar item; otherwise <doc://com.apple.documentation/documentation/Swift/false>.

`badgeText`

String to display on the badge. Pass `nil` to remove the badge.

## Discussion

The badge text is visible even when the toolbar item is disabled.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)