# Interface: ButtonEvent<Button>

[Mobile Document Scanner API Reference](../index.md) / ButtonEvent

# Interface: ButtonEvent\<Button\>

Defined in: [src/settings/buttons.ts:96](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/settings/buttons.ts#L96)

The event that the [onClick](ButtonSettings.md#onclick) handler of a button
gets. It works like the DOM event that it replaces, with one difference. The
document scanner waits for the handler before it acts, so `preventDefault()`
still works after an `await`.

## Type Parameters

### Button

`Button` *extends* `string` = `string`

## Properties

### button

> `readonly` **button**: `Button`

Defined in: [src/settings/buttons.ts:98](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/settings/buttons.ts#L98)

The name of the button that the user pressed.

***

### defaultPrevented

> `readonly` **defaultPrevented**: `boolean`

Defined in: [src/settings/buttons.ts:106](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/settings/buttons.ts#L106)

Whether the handler called `preventDefault()`.

***

### mode?

> `readonly` `optional` **mode?**: `"filter"` \| keyof RectifyModes

Defined in: [src/settings/buttons.ts:102](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/settings/buttons.ts#L102)

The mode that the screen shows, if it shows one.

***

### phase

> `readonly` **phase**: [`PhaseName`](../type-aliases/PhaseName.md)

Defined in: [src/settings/buttons.ts:100](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/settings/buttons.ts#L100)

The phase of the screen that shows the button.

## Methods

### preventDefault()

> **preventDefault**(): `void`

Defined in: [src/settings/buttons.ts:104](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/settings/buttons.ts#L104)

Stop the default action of the button.

#### Returns

`void`
