Skip to content

feat: add renderGhost option for customizing drag ghost element content#274

Open
AlexDev404 wants to merge 5 commits intoAlfred-Skyblue:mainfrom
AlexDev404:main
Open

feat: add renderGhost option for customizing drag ghost element content#274
AlexDev404 wants to merge 5 commits intoAlfred-Skyblue:mainfrom
AlexDev404:main

Conversation

@AlexDev404
Copy link
Copy Markdown

@AlexDev404 AlexDev404 commented Apr 1, 2026

This serves to add renderGhost to the component, allowing users to customize the ghost image of the drag and drop action.

Usage

Component usage:

<VueDraggable 
  v-model="list" 
  :renderGhost="(ghostEl, data) => {
    ghostEl.innerHTML = `<div class='custom-ghost'>Moving: ${data.name}</div>`
  }"
>
  <!-- items -->
</VueDraggable>

Or with the composable:

useDraggable(el, list, {
  renderGhost: (ghostEl, data) => {
    ghostEl.innerHTML = `<div class='custom-ghost'>Moving: ${data.name}</div>`
  }
})

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 1, 2026

Deploy Preview for vue-draggable-plus ready!

Name Link
🔨 Latest commit 706f275
🔍 Latest deploy log https://app.netlify.com/projects/vue-draggable-plus/deploys/69cd5cc0b8ce1b0008b88c42
😎 Deploy Preview https://deploy-preview-274--vue-draggable-plus.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI and others added 2 commits April 1, 2026 17:54
Sortable.ghost only exists when SortableJS runs in fallback mode.
Without forceFallback: true, the browser uses native HTML5 drag
images and Sortable.ghost is null, causing renderGhost to silently
do nothing.

Agent-Logs-Url: https://github.com/AlexDev404/vue-draggable-plus/sessions/394b261e-0741-4931-b40a-c8c82be32096

Co-authored-by: AlexDev404 <34188635+AlexDev404@users.noreply.github.com>
fix: auto-enable forceFallback when renderGhost is provided
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants