<!--
{
  "availability" : [
    "macOS: 10.4.0 - 10.12.0"
  ],
  "documentType" : "symbol",
  "framework" : "PDFKit",
  "identifier" : "/documentation/PDFKit/PDFAnnotationButtonWidget",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "PDFKit"
    ],
    "preciseIdentifier" : "c:objc(cs)PDFAnnotationButtonWidget"
  },
  "title" : "PDFAnnotationButtonWidget"
}
-->

# PDFAnnotationButtonWidget

A `PDFAnnotationButtonWidget` object provides user interactivity on a page of a PDF document. There are three types of buttons available: push button, radio button, and checkbox.

```
class PDFAnnotationButtonWidget
```

## Overview

`PDFAnnotationButtonWidget` inherits general annotation behavior from the `PDFAnnotation` class. If you use a `PDFAnnotationButtonWidget` object, your application must handle hit testing, unless you are simply using `PDFView` to display content. This is because `PDFView` automatically handles hit testing for you.

## Topics

### Getting and Setting the Control Type

[`-  controlType`](/documentation/PDFKit/PDFAnnotationButtonWidget/controlType())

Returns the type of the control.

[`-  setControlType:`](/documentation/PDFKit/PDFAnnotationButtonWidget/setControlType(_:))

Sets the type of the control.

### Getting and Setting the Control’s State

[`-  state`](/documentation/PDFKit/PDFAnnotationButtonWidget/state())

Returns the state of the control.

[`-  setState:`](/documentation/PDFKit/PDFAnnotationButtonWidget/setState(_:))

Sets the state of the control.

### Getting and Setting the Control’s Appearance

[`-  backgroundColor`](/documentation/PDFKit/PDFAnnotationButtonWidget/backgroundColor())

Returns the background color of the control.

[`-  setBackgroundColor:`](/documentation/PDFKit/PDFAnnotationButtonWidget/setBackgroundColor(_:))

Sets the control’s background color.

### Getting and Setting the Control Label Font Attributes

[`-  font`](/documentation/PDFKit/PDFAnnotationButtonWidget/font())

Returns the font used in the control’s label.

[`-  setFont:`](/documentation/PDFKit/PDFAnnotationButtonWidget/setFont(_:))

Sets the font of the control’s label.

[`-  fontColor`](/documentation/PDFKit/PDFAnnotationButtonWidget/fontColor())

Returns the font color used in the control’s label.

[`-  setFontColor:`](/documentation/PDFKit/PDFAnnotationButtonWidget/setFontColor(_:))

Sets the font color used in the control’s label.

### Getting and Setting the Control Label Text

[`-  caption`](/documentation/PDFKit/PDFAnnotationButtonWidget/caption())

Returns the text of the label on a push button control.

[`-  setCaption:`](/documentation/PDFKit/PDFAnnotationButtonWidget/setCaption(_:))

Sets the text of the label on a push button control.

### Managing Radio Button Behavior

[`-  allowsToggleToOff`](/documentation/PDFKit/PDFAnnotationButtonWidget/allowsToggleToOff())

Returns a Boolean value indicating whether a radio button behaves in a toggling manner.

### Managing Control State Values and Form Fields

[`-  onStateValue`](/documentation/PDFKit/PDFAnnotationButtonWidget/onStateValue())

Returns the string associated with the on state of a radio button or checkbox control.

[`-  setOnStateValue:`](/documentation/PDFKit/PDFAnnotationButtonWidget/setOnStateValue(_:))

Sets the string that is associated with the on state of a radio button or checkbox control.

[`-  fieldName`](/documentation/PDFKit/PDFAnnotationButtonWidget/fieldName())

Returns the internal name of a field (used for reset-form actions).

[`-  setFieldName:`](/documentation/PDFKit/PDFAnnotationButtonWidget/setFieldName(_:))

Sets the internal name of a field (used for reset-form actions).

### Constants

[`PDFWidgetControlType`](/documentation/PDFKit/PDFWidgetControlType)

The types of annotation buttons.

### Instance Methods

[`-  setAllowsToggleToOff:`](/documentation/PDFKit/PDFAnnotationButtonWidget/setAllowsToggleToOff(_:))

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Equatable`](/documentation/Swift/Equatable)

### Inherits From

[`PDFAnnotation`](/documentation/PDFKit/PDFAnnotation)

---

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)