---
title: "setButtonType(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsbuttoncell/setbuttontype(_:)"
---

# setButtonType(_:)

Sets how the button highlights while pressed and how it shows its state.

## Declaration

```swift
func setButtonType(_ type: NSButton.ButtonType)
```

## Parameters

- `type`: A constant specifying the type of button. This can be one of the constants defined in doc://com.apple.appkit/documentation/AppKit/NSButton/ButtonType.

## Discussion

Discussion The  setButtonType(_:) method redisplays the button before returning. The types available are for the most common button types, which are also accessible in Interface Builder; you can configure different behavior with the highlightsBy and showsStateBy properties. Note that there is no -buttonType method. The set method sets various button properties that together establish the behavior of the type.

## See Also

### Related Documentation

- [image](appkit/nscell/image.md)
- [alternateImage](appkit/nsbuttoncell/alternateimage.md)

### Displaying the Cell

- [highlightsBy](appkit/nsbuttoncell/highlightsby.md)
- [showsStateBy](appkit/nsbuttoncell/showsstateby.md)
