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

# setButtonType(_:)

Sets the button’s type, which affects its user interface and behavior when clicked.

## Declaration

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

## Parameters

- `type`: A constant specifying the type of the button. The available button types are listed under doc://com.apple.appkit/documentation/AppKit/NSButton/ButtonType in the doc://com.apple.appkit/documentation/AppKit/NSButtonCell class.

## Discussion

Discussion This method causes the button to update to reflect the new type before the method finishes executing. The types available are for the most common button types, which are also accessible in Interface Builder. You can configure different behavior with the NSButtonCell methods  highlightsBy and showsStateBy. 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/nsbutton/image.md)
- [setButtonType(_:)](appkit/nsbuttoncell/setbuttontype(_:).md)
- [alternateImage](appkit/nsbutton/alternateimage.md)

### Configuring buttons

- [getPeriodicDelay(_:interval:)](appkit/nsbutton/getperiodicdelay(_:interval:).md)
- [setPeriodicDelay(_:interval:)](appkit/nsbutton/setperiodicdelay(_:interval:).md)
- [contentTintColor](appkit/nsbutton/contenttintcolor.md)
- [hasDestructiveAction](appkit/nsbutton/hasdestructiveaction.md)
- [alternateTitle](appkit/nsbutton/alternatetitle.md)
- [attributedTitle](appkit/nsbutton/attributedtitle.md)
- [attributedAlternateTitle](appkit/nsbutton/attributedalternatetitle.md)
- [title](appkit/nsbutton/title.md)
- [symbolConfiguration](appkit/nsbutton/symbolconfiguration.md)
- [sound](appkit/nsbutton/sound.md)
- [isSpringLoaded](appkit/nsbutton/isspringloaded.md)
- [maxAcceleratorLevel](appkit/nsbutton/maxacceleratorlevel.md)
- [tintProminence](appkit/nsbutton/tintprominence.md)
- [NSTintProminence](appkit/nstintprominence.md)
- [borderShape](appkit/nsbutton/bordershape.md)
