# DragAndDropTarget

Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/draganddrop/DragAndDrop.kt+class:androidx.compose.ui.draganddrop.DragAndDropTarget) Added in [1.6.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.6.0) Common/AllAndroid/JVM
- Cmn

  ```
  interface DragAndDropTarget
  ```
Known direct subclasses [DragAndDropModifierNode](https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropModifierNode)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropModifierNode` | **This interface is deprecated.** This interface is deprecated in favor to DragAndDropSourceModifierNode and DragAndDropTargetModifierNode |

*** ** * ** ***

Provides a means of receiving a transfer data from a drag and drop session.

## Summary

| ### Public functions |
|---|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget#onChanged(androidx.compose.ui.draganddrop.DragAndDropEvent)(event: https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropEvent)` An event in the current drag and drop session has changed within this `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget` bounds. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget#onDrop(androidx.compose.ui.draganddrop.DragAndDropEvent)(event: https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropEvent)` An item has been dropped inside this `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget`. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget#onEnded(androidx.compose.ui.draganddrop.DragAndDropEvent)(event: https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropEvent)` The drag and drop session has been completed. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget#onEntered(androidx.compose.ui.draganddrop.DragAndDropEvent)(event: https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropEvent)` An item being dropped has entered into the bounds of this `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget`. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget#onExited(androidx.compose.ui.draganddrop.DragAndDropEvent)(event: https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropEvent)` An item being dropped has moved outside the bounds of this `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget`. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget#onMoved(androidx.compose.ui.draganddrop.DragAndDropEvent)(event: https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropEvent)` An item being dropped has moved within the bounds of this `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget`. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget#onStarted(androidx.compose.ui.draganddrop.DragAndDropEvent)(event: https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropEvent)` A drag and drop session has just been started and this `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget` is eligible to receive it. | Cmn |

## Public functions

### onChanged

Cmn Added in [1.6.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.6.0)

```
open fun onChanged(event: DragAndDropEvent): Unit
```

An event in the current drag and drop session has changed within this `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget` bounds. Perhaps a modifier key has been pressed or released.

### onDrop

Cmn Added in [1.6.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.6.0)

```
fun onDrop(event: DragAndDropEvent): Boolean
```

An item has been dropped inside this `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget`.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true to indicate that the `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropEvent` was consumed; false indicates it was rejected. |

### onEnded

Cmn Added in [1.6.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.6.0)

```
open fun onEnded(event: DragAndDropEvent): Unit
```

The drag and drop session has been completed. All `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget` instances in the hierarchy that previously received an `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget#onStarted(androidx.compose.ui.draganddrop.DragAndDropEvent)` event will receive this event. This gives an opportunity to reset the state for a `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget`.

### onEntered

Cmn Added in [1.6.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.6.0)

```
open fun onEntered(event: DragAndDropEvent): Unit
```

An item being dropped has entered into the bounds of this `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget`.

### onExited

Cmn Added in [1.6.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.6.0)

```
open fun onExited(event: DragAndDropEvent): Unit
```

An item being dropped has moved outside the bounds of this `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget`.

### onMoved

Cmn Added in [1.6.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.6.0)

```
open fun onMoved(event: DragAndDropEvent): Unit
```

An item being dropped has moved within the bounds of this `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget`.

### onStarted

Cmn Added in [1.6.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.6.0)

```
open fun onStarted(event: DragAndDropEvent): Unit
```

A drag and drop session has just been started and this `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget` is eligible to receive it. This gives an opportunity to set the state for a `https://developer.android.com/reference/kotlin/androidx/compose/ui/draganddrop/DragAndDropTarget` in preparation for consuming a drag and drop session.