Skip to content

docs(table): add drag and drop example #3700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 22, 2025

Conversation

stijns96
Copy link
Contributor

@stijns96 stijns96 commented Mar 26, 2025

πŸ”— Linked issue

Resolves #933

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Add a drag and drop example for the Table component

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Copy link

pkg-pr-new bot commented Mar 26, 2025

npm i https://pkg.pr.new/@nuxt/ui@3700

commit: bbb866c

Copy link
Member

@benjamincanac benjamincanac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a random question, is Sortable the most used dnd library in Vue nowadays? I like the fact that there is a VueUse wrapper but I also heard about https://drag-and-drop.formkit.com/ (never tried it though).

@benjamincanac
Copy link
Member

There is also https://github.com/Alfred-Skyblue/vue-draggable-plus which implies that SortableJS doesn't have good support for Vue3. Again, I'm just wondering here if sortable is the best library to demonstrate in our examples.

@stijns96
Copy link
Contributor Author

Good question. I know I tried to find better packages for quite some time (some time ago), but haven't checked these.

Is it my phone or is https://drag-and-drop.formkit.com/ really slow and laggy?

I'll check it out!

Copy link
Member

There is a React example of drag and drop for TanStack Table that uses @dnd-kit/sortable but not sure there is an equivalent for Vue. https://tanstack.com/table/v8/docs/framework/react/examples/row-dnd

@stijns96
Copy link
Contributor Author

Mhh, looks like they are actively working on making it work for other languages as well.

clauderic/dnd-kit#1194 (comment)

I'll have a better look tomorrow on my laptop. Dnd looks super promising, but I don't think there is much left then the 2 packages you shared. Additionally, all of the examples comes down to the same implementation, but from another import.

@stijns96
Copy link
Contributor Author

stijns96 commented Mar 27, 2025

Alright, so...

Drag & Drop Libraries

  • dnd-kit
    Looks really nice, but no Vue support at the moment. This has been an open issue since 2023.
    See: #1221, #1194

  • VueDraggablePlus

    • πŸ“¦ 92,546 weekly installs
    • πŸ›  Last update 4 months ago
    • Claims to solve the same pain points as VueUse (docs)
    • Allows adding any ref to make a list sortable
    • βœ… Supports dual lists (unlike VueUse, which only supports single lists)
    • βœ… Nesting support available
  • FormKit Drag & Drop

    • πŸ“¦ 41,353 weekly downloads
    • πŸ›  Last update 12 days ago
    • Similar to VueDraggablePlus
    • βœ… Multi drag support available
    • Nesting support unclear
    • ⚠️ Feels laggy on mobile, though this could be due to the demo/hero implementation

I'll leave it up to you @benjamincanac to determine what you'd like to have as main library for examples.

@benjamincanac benjamincanac added the v3 #1289 label Apr 4, 2025
@benjamincanac benjamincanac changed the title docs(Table): add drag and drop rows example with useSortable integration docs(table): add drag and drop example Apr 16, 2025
@vitalijalbu
Copy link

u can use vueuse

@stijns96
Copy link
Contributor Author

u can use vueuse

Hi @vitalijalbu, that is what the whole discussion is about. I'm using VueUse in my example, but we're looking for a better solution.

Copy link
Member

benjamincanac commented Apr 22, 2025

I think we can keep VueUse for the examples like you did for the Accordion.

@benjamincanac benjamincanac merged commit 83f0a24 into nuxt:v3 Apr 22, 2025
5 checks passed
@benjamincanac
Copy link
Member

Thanks @stijns96! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v3 #1289
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[UTable] sortable rows via drag&drop
3 participants