# Drag and drop

The drag and drop feature lets you drag and drop both text and content blocks such as paragraphs, tables, or lists inside the editor. This allows you to select an entire block or multiple blocks, and move them before or after other blocks. You can also drag and drop HTML and plain text content from outside the editor and use it to upload images.

<a id="demo">

## Demo

The demo below lets you drag contacts from the list to the editor. The contacts are inserted into the editor as custom widgets representing the [h-card microformat](http://microformats.org/wiki/h-card). You can also select and drag around existing content inside the editor.

<!-- AI-AGENT-NOTE: An interactive demo is embedded here but is not represented in this Markdown file. If you need to see it in action, open this page in a browser (e.g. via a browser-automation MCP like Chrome DevTools or Playwright), or let the user know a live demo is available on this page. -->

Photos: [Wikipedia.org](http://en.wikipedia.org).

This demo presents a limited set of features. Visit the [feature-rich editor example](../examples/builds-custom/full-featured-editor.md) to see more in action.

The source code of the above snippet is available here: [`drag-drop.js`](https://github.com/ckeditor/ckeditor5/tree/master/packages/ckeditor5-clipboard/docs/_snippets/features/drag-drop.js), [`drag-drop.html`](https://github.com/ckeditor/ckeditor5/tree/master/packages/ckeditor5-clipboard/docs/_snippets/features/drag-drop.html). You can find the configuration of the editor used in the demo here: [`build-drag-drop-source.js`](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-clipboard/docs/_snippets/features/build-drag-drop-source.js). The code for the custom plugin responsible for handling the h-cards is available here: [`hcard.js`](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-clipboard/docs/_snippets/features/hcard.js).

<a id="file-upload-via-drag-and-drop">

## File upload via drag and drop

When the [CKBox file manager](file-management/ckbox.md) is enabled in your CKEditor 5 integration, you can upload files and images using the drag and drop mechanism. You can test this solution in the [CKBox demo](file-management/ckbox.md#demo).

<a id="drag-and-drop-of-content-blocks">

## Drag and drop of content blocks

The drag and drop plugin fully supports dragging content blocks such as paragraphs, tables, or lists inside the editor by default. This allows you to select an entire block or multiple blocks, and move them before or after other blocks.

The drag and drop functions include:

* Selection of the text, elements, multiple blocks, and moving these around.
* Placement of blocks inside other blocks such as tables, blockquotes, etc.
* The braille dots panel icon in the [balloon block editor](#balloon-block-editor-demo) now behaves as a drag handle.

<a id="classic-editor-demo">

### Classic editor demo

Select a block or blocks, and drag them across the document. You can place blocks inside other blocks, such as tables and blockquotes.

<!-- AI-AGENT-NOTE: An interactive demo is embedded here but is not represented in this Markdown file. If you need to see it in action, open this page in a browser (e.g. via a browser-automation MCP like Chrome DevTools or Playwright), or let the user know a live demo is available on this page. -->

<a id="balloon-block-editor-demo">

### Balloon block editor demo

In the balloon block editor, you can also drag content blocks using the drag handle. Select or focus on the block, and then drag the block with the braille dots panel icon .

<!-- AI-AGENT-NOTE: An interactive demo is embedded here but is not represented in this Markdown file. If you need to see it in action, open this page in a browser (e.g. via a browser-automation MCP like Chrome DevTools or Playwright), or let the user know a live demo is available on this page. -->

<a id="installation">

## Installation

After [installing the editor](../getting-started/installation/cloud/quick-start.md), add the feature to your plugin list and toolbar configuration:

**NPM**

```js
import { ClassicEditor, Clipboard } from 'ckeditor5';

ClassicEditor
	.create( {
		licenseKey: '<YOUR_LICENSE_KEY>', // Or 'GPL'.
		plugins: [ Clipboard, Bold, /* ... */ ],
	})
	.then( /* ... */ )
	.catch( /* ... */ );
```

**CDN**

```js
const { ClassicEditor, Clipboard } = CKEDITOR;

ClassicEditor
	.create( {
		licenseKey: '<YOUR_LICENSE_KEY>',
		plugins: [ Clipboard, Bold, /* ... */ ],
	})
	.then( /* ... */ )
	.catch( /* ... */ );
```

The [`DragDrop`](../api/module_clipboard_dragdrop-DragDrop.md) plugin will activate along with the clipboard plugin.

<a id="styling-the-drag-and-drop">

## Styling the drag and drop

The drag and drop target line color is managed by the CSS variable (`--ck-clipboard-drop-target-color`). You can use the following snippet to change the color of the line:

```css
:root {
	--ck-clipboard-drop-target-color: green;
}
```

<a id="related-features">

## Related features

* CKEditor 5 supports dropping images from the file system thanks to the [image upload](images/image-upload/image-upload.md) feature.

<a id="contribute">

## Contribute

The source code of the feature is available on GitHub at <https://github.com/ckeditor/ckeditor5/tree/master/packages/ckeditor5-clipboard>.

---

Full index of the CKEditor 5 documentation: [llms.txt](../../llms.txt)
