Cards

Draggable Card

Interactive card that can be dragged around with 3D tilt effects.

The DraggableCard component creates an interactive card that can be dragged around with 3D tilt effects. It combines drag functionality with dynamic 3D transformations for a playful, engaging user experience.

Usage

Draggable Card

This card can be dragged around the screen.

<template>
  <MDraggableCard>
    <template #header>
      <h3 class="text-lg font-semibold">
        Draggable Card
      </h3>
    </template>
    <p>This card can be dragged around the screen.</p>
  </MDraggableCard>
</template>

Examples

Basic Draggable Card

Interactive Widget

Drag Me

This draggable card can be moved around the screen. Try dragging it to reposition it anywhere!

Release to snap back to position
Drag handle in top right
<template>
  <div class="flex justify-center p-6">
    <MDraggableCard class="w-full max-w-md">
      <template #header>
        <div class="flex items-center justify-between">
          <h3 class="text-2xl font-bold text-highlighted">
            Interactive Widget
          </h3>
          <UBadge
            color="primary"
            variant="soft"
          >
            Drag Me
          </UBadge>
        </div>
      </template>
      <div class="space-y-6">
        <p class="text-muted">
          This draggable card can be moved around the screen. Try dragging it to reposition it anywhere!
        </p>
        <div class="flex items-center p-4 bg-primary/5 dark:bg-primary/30 rounded-lg">
          <UIcon
            name="i-lucide-info"
            class="w-6 h-6 text-primary mr-4"
          />
          <span class="text-sm text-primary">Release to snap back to position</span>
        </div>
        <div class="grid grid-cols-2 gap-3">
          <UButton
            color="primary"
            variant="solid"
            size="sm"
            block
          >
            Action
          </UButton>
          <UButton
            color="neutral"
            variant="outline"
            size="sm"
            block
          >
            Options
          </UButton>
        </div>
      </div>
      <template #footer>
        <div class="flex items-center justify-between">
          <span class="text-xs text-muted">Drag handle in top right</span>
          <UIcon
            name="i-lucide-move"
            class="w-5 h-5 text-dimmed"
          />
        </div>
      </template>
    </MDraggableCard>
  </div>
</template>

Customize

Motion primitive

Hover, drag or scroll to interact

Customize

No customizable props detected for this component.

Props

Prop Type Default Description
classstring''CSS classes to apply to the card content.
containerClassstring''CSS classes to apply to the card container.
uiobject{}UI configuration for the underlying UCard component.

UI

This component's theme exposes the slots below. Override any of them per instance with the ui prop, or app-wide under ui.draggableCard in app.config.ts.

Prop Type Default Description
uiobject-Per-slot classes merged over the theme defaults.
Slot Props Description
root-[perspective:3000px] w-fit h-fit
card-w-full h-full
cardRoot-relative min-h-96 w-80 overflow-hidden rounded-md bg-default dark:bg-default p-6 shadow-2xl transform-3d
cardBody-relative z-10
cardHeader-relative z-10
cardFooter-relative z-10
glare-pointer-events-none absolute inset-0 bg-default select-none z-20
Copyright © 2026