# ButtonNode
Class Inherits FormControlNode
## About
`ButtonNode` represents an HTML button with canvas-editable caption text. It supports button type, name, submitted value, disabled state, and form-submission override attributes.
## Enumerations
| Name | Value | Description |
| --- | :---: | --- |
| Types | Submit <br > Reset <br > Button | (None) |
## Methods
| Name | Parameters | Return Type | Description |
| --- | :---: | :---: | --- |
| ActionItem | index As Integer | ToolbarItem | Returns the contextual toolbar item at the specified index. |
| AddVectorPDFAnnotations | pdf As PDFDocument <br> pageNumber As Integer <br> offsetX As Double <br> offsetY As Double <br> usedNames As Dictionary <br> formAction As String = "" | (None) | Adds this node's interactive annotations and form controls to a vector PDF page. Override for custom nodes. |
| Constructor | caption As String = "" | (None) | Creates a new button node. |
| Duplicate | (None) | Node | Returns an independent copy of this node. |
| FromHTML | element As GraffitiProEditor.HTMLSupport.HTMLElement | Boolean | Imports supported content from an HTML button element. |
| FromJSON | data As JSONItem | Boolean | Restores state from JSON. |
| HTMLTags | (None) | String | Returns the HTML tag names supported by this node type. |
| InspectorSections | (None) | InspectorSection | Returns the user-editable button properties exposed by the inspector. |
| LastActionIndex | (None) | Integer | Returns the last zero-based action index supplied by this node, or -1 when there are no actions. |
| LocalizeToolbarItem | strings As GraffitiProEditor.Editor | (None) | Sets this node type's toolbar item text from the supplied editor's localization properties. The editor calls it when the type is registered, when the editor opens, and when a locale pack is applied to the editor. A custom node type can override it to localize its own toolbar item. |
| PerformAction | index As Integer <br> selectedItem As DesktopMenuItem | (None) | Handles the contextual toolbar action. |
| PerformToolbarAction | editor As Editor <br> selectedItem As DesktopMenuItem | (None) | Handles activation of the main-toolbar item. |
| PreferredHeight | g As Graphics <br> availableWidth As Double | Double | Returns the preferred height. |
| Render | g As Graphics <br> bounds As Rect <br> selected As Boolean | (None) | Draws the button preview. |
| SupportsTextAlignment | (None) | Boolean | Returns whether the node draws text that follows its TextAlignment. |
| ToHTML | (None) | String | Returns an HTML representation of this content. |
| ToJSON | (None) | JSONItem | Returns the persistent state as JSON. |
| TypeName | (None) | String | Returns the display name. |
## Properties
| Name | Type | Default Value | Description |
| --- | :---: | :---: | --- |
| Caption | String | (None) | Gets or sets the value. |
| Command | String | (None) | Gets or sets the command keyword. |
| CommandFor | String | (None) | Gets or sets the command target element ID. |
| FormAction | String | (None) | Gets or sets the form submission URL override. |
| FormEnctype | String | (None) | Gets or sets the form submission encoding override. |
| FormMethod | String | (None) | Gets or sets the form submission method override. |
| FormNoValidate | Boolean | (None) | Gets or sets whether submission bypasses form validation. |
| FormTarget | String | (None) | Gets or sets the form submission browsing-context name. |
| PopoverTarget | String | (None) | Gets or sets the popover target element ID. |
| PopoverTargetAction | String | (None) | Gets or sets the popover target action. |
| Type | Types | (None) | Gets or sets the button type. |
| Value | String | (None) | Gets or sets the submitted button value. |
## Notes
Button caption editing is separate from submitted form values.
### Caption and Value
The visible caption and submitted value are separate. Editing the node text changes its caption. Use the inspector for the submitted value and form-related attributes. Measurement expands to fit the caption without wrapping ordinary button text unexpectedly.
### JSON Values
`buttonType` stores `ButtonNode.Types` as an integer: `0` Submit, `1` Reset, and `2` Button. `caption`, `command`, `commandFor`, `formAction`, `formEnctype`, `formMethod`, `formTarget`, `popoverTarget`, `popoverTargetAction`, and `value` are strings. `formNoValidate` is Boolean. Common form-control and node fields are supplied by the superclass serializers.
Each field is omitted at its default and restored to it when missing: empty strings, `formNoValidate` `False`, and `buttonType` Submit.