# Click Event

Name

Bubble Supported

Description

onClick(callback: (event?: ClickEvent) => void)

No

Called when a click event occurs. For details about the event parameters, see ClickEvent object.

- ClickEvent object

Name

Type

Description

screenX

number

X coordinate of the click relative to the left edge of the screen.

screenY

number

Y coordinate of the click relative to the upper edge of the screen.

x

number

X coordinate of the click relative to the left edge of the component being clicked.

y

number

Y coordinate of the click relative to the upper edge of the component being clicked.

timestamp

number

Timestamp of the event.

## Example ``` @Entry @Component struct ClickExample { @State text: string = '' build() { Column() { Button('Click').backgroundColor(0x2788D9) .onClick((event: ClickEvent) => { console.info(this.text = 'Button clicked!\n X:' + event.x + '\n' + ' Y:' + event.y) }) Text(this.text).padding(15) }.height(300).width('100%').padding(35) } } ``` ![](figures/click.gif)