@vue-dnd-kit/nuxt
@vue-dnd-kit/nuxt
Official Nuxt module for Vue DnD Kit — a lightweight, high-performance drag and drop library for Vue 3.
Features
- Auto-imports all composables (
makeDraggable,makeDroppable,makeSelectionArea, and more) - Registers
DnDProviderandDragPreviewas global components — use them in templates without importing - Fully SSR-compatible — no hydration mismatches, content rendered on server
Quick Setup
npm install @vue-dnd-kit/nuxt @vue-dnd-kit/core
Add to nuxt.config.ts:
export default defineNuxtConfig({
modules: ['@vue-dnd-kit/nuxt'],
})
Usage
Wrap your layout with DnDProvider, then use composables inside child components. makeDraggable and other composables rely on inject — they must run inside a descendant of DnDProvider, not in the same component.
<!-- layouts/default.vue -->
<template>
<DnDProvider>
<slot />
<DragPreview />
</DnDProvider>
</template>
<!-- components/DraggableItem.vue -->
<script setup>
const el = useTemplateRef('el');
makeDraggable(el, {
payload: () => [0, items.value],
});
</script>
<template>
<div ref="el">Drag me</div>
</template>
For TypeScript types, import explicitly from the core package:
import type { IDragEvent, IDragItem } from '@vue-dnd-kit/core';
Compatibility
| Version | |
|---|---|
| Nuxt | ^4.0.0 |
@vue-dnd-kit/core |
^2.4.0 |
| Vue | ^3.5.0 |
License
MIT
Related Packages
@vue-dnd-kit/core
Core functionality for Vue DnD Kit - a lightweight Vue 3 library for building pe...
331,461
257
@vue-dnd-kit/utilities
Utilities for Vue DnD Kit - a lightweight Vue 3 library for building performant...
16,713
257
Version History
| Version | Released | License |
|---|---|---|
| 1.0.2 | MIT | |
| 1.0.1 | MIT |