Skip to main content
Dnd-kit provides built-in animation support for drag operations and automatic layout transitions. Learn how to customize animations for a polished user experience.

Sortable Transitions

Sortable items automatically animate when their position changes:

Transition Properties

  • duration - Animation length in milliseconds (default: 250)
  • easing - CSS easing function (default: 'cubic-bezier(0.25, 1, 0.5, 1)')
  • idle - Whether to animate position changes when not dragging (default: false)

Default Transition Configuration

The default sortable transition provides smooth, natural movement:
This configuration:
  • Uses a 250ms duration for quick but visible movement
  • Applies a custom cubic-bezier for natural acceleration
  • Only animates during active drag operations

Custom Easing Functions

Use different easing functions to change animation feel:
Use cubic-bezier.com to visually design custom easing curves.

Idle Transitions

Enable idle to animate items even when not dragging:
Enabling idle: true can impact performance with large lists. Use sparingly for lists with fewer than 100 items.

Disabling Transitions

Disable transitions by setting transition to null:

How Transitions Work

Sortable transitions use the FLIP technique (First, Last, Invert, Play):
  1. First - Record the element’s initial position
  2. Last - Update the DOM and record the final position
  3. Invert - Calculate the difference and apply a transform
  4. Play - Animate the transform back to 0
From the source code:
This technique ensures smooth transitions without layout thrashing.

Drag Overlay Animations

Customize the drag overlay appearance during drag operations:

Styling During Drag States

Apply different styles based on drag state:

CSS-Based Animations

Combine with CSS for additional effects:

CSS Layers Support

Dnd-kit works seamlessly with CSS layers:

Performance Optimization

The library automatically optimizes animations:

Transform-Based Movement

Animations use CSS translate instead of top/left for better performance:

Canceling CSS Transitions

The library cancels conflicting CSS transitions before measuring:
This prevents incorrect position calculations during transitions.

Reduced Motion Support

The library automatically respects user motion preferences:
You can also detect this manually:
Always respect prefers-reduced-motion for accessibility. Users with vestibular disorders rely on this setting.

Advanced: Custom Animation Hook

Create a reusable hook for consistent animations:

Next Steps

1

Experiment with Easing

Try different easing functions to find the right feel for your interface
2

Test Performance

Profile animations with large lists to ensure smooth 60fps rendering
3

Add Visual Feedback

Combine transitions with accessibility features for comprehensive UX