---
title: "setEnabled(_:withBadgeText:)"
framework: safariservices
role: symbol
role_heading: Instance Method
path: "safariservices/sfsafaritoolbaritem/setenabled(_:withbadgetext:)"
---

# setEnabled(_:withBadgeText:)

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

## Declaration

```swift
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

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

## See Also

### Controlling Toolbar Items

- [setBadgeText(_:)](safariservices/sfsafaritoolbaritem/setbadgetext(_:).md)
- [setEnabled(_:)](safariservices/sfsafaritoolbaritem/setenabled(_:).md)
- [setImage(_:)](safariservices/sfsafaritoolbaritem/setimage(_:).md)
- [setLabel(_:)](safariservices/sfsafaritoolbaritem/setlabel(_:).md)
