# Events

The FloatingToolbar emits events in response to dragging, programmatic moves, and resizing of the hosted Toolbar.

## Drag Events

The FloatingToolbar exposes the following lowercase Vue events for drag and position changes:

* `dragstart`—Fires before a pointer drag or keyboard Move mode begins. Call `event.preventDefault()` to cancel it. The payload type is `FloatingToolbarDragStartEvent`.
* `move`—Fires when the position changes through pointer dragging, keyboard Move mode, or `setPosition`. The payload type is `FloatingToolbarMoveEvent`.
* `dragend`—Fires when pointer dragging ends or keyboard Move mode exits, including cancellation with `Escape`. The payload type is `FloatingToolbarDragEndEvent`.

Each movement event includes the `target` FloatingToolbar handle, `top` and `left` coordinates, a `drag` flag, and the originating DOM `event`. The `drag` flag is `true` for pointer dragging and `false` for keyboard or programmatic movement. For `setPosition` calls, `event` is `undefined`.

Use Vue listeners to subscribe to these events:

```vue
<FloatingToolbar
    :draggable="true"
    @dragstart="handleDragstart"
    @move="handleMove"
    @dragend="handleDragend"
    @resize="handleResize"
/>
```

For TypeScript callback props, `FloatingToolbarProps` uses the names `onDragstart`, `onMove`, `onDragend`, and `onResize`.

The following example logs drag start, drag end, and position changes.

[Demo Source](https://demos.telerik.com/kendo-vue-ui/buttons/floatingtoolbar/events/source.txt)

## Resize Event

The `resize` event is forwarded from the hosted Toolbar without changing its `ToolbarResizeEvent` payload. It fires when a window resize changes the Toolbar's dimensions and includes the hosted Toolbar's `offsetWidth` and `offsetHeight`.

## Canceling a Drag Operation

Call `event.preventDefault()` in the `dragstart` handler to cancel the operation. Neither `move` nor `dragend` fires for that canceled interaction. You can use `event.isDefaultPrevented()` to check whether the operation was canceled.

The following example lets you lock the toolbar to prevent repositioning. Click **Lock** and try to drag the handle or enter keyboard Move mode. Click **Unlock** to enable movement again.

[Demo Source](https://demos.telerik.com/kendo-vue-ui/buttons/floatingtoolbar/events/cancel-drag/source.txt)

## Suggested Links

* [FloatingToolbar Overview](https://www.telerik.com/kendo-vue-ui-develop/components/buttons/floatingtoolbar)
* [Dragging](https://www.telerik.com/kendo-vue-ui-develop/components/buttons/floatingtoolbar/dragging)
