Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsMay 18, 2026·3 min de lecture

react-beautiful-dnd — Accessible Drag and Drop for React Lists

A drag-and-drop library for React that provides beautiful, accessible list reordering with keyboard and screen reader support out of the box.

Prêt pour agents

Cet actif peut être lu et installé directement par les agents

TokRepo expose une commande CLI universelle, un contrat d'installation, le metadata JSON, un plan selon l'adaptateur et le contenu raw pour aider les agents à juger l'adaptation, le risque et les prochaines actions.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
react-beautiful-dnd
Commande CLI universelle
npx tokrepo install 7cb5f1fe-524e-11f1-9bc6-00163e2b0d79

Introduction

react-beautiful-dnd is a drag-and-drop library by Atlassian designed for reordering lists in React applications. It prioritizes accessibility, natural movement physics, and a declarative API that integrates cleanly with React component patterns.

What react-beautiful-dnd Does

  • Enables vertical, horizontal, and cross-list drag-and-drop reordering
  • Provides full keyboard navigation and screen reader announcements for every drag operation
  • Applies physics-based movement with natural drop animations
  • Supports conditional dragging, droppable placeholders, and scroll containers
  • Works with virtualized lists via community adapters for react-window and react-virtualized

Architecture Overview

The library uses a context-based architecture with three core components: DragDropContext manages global drag state and events, Droppable defines drop zones using render props, and Draggable wraps each item. During a drag, the library calculates displacement maps and applies CSS transforms for performance, avoiding layout thrashing.

Self-Hosting & Configuration

  • Install via npm or yarn and import the three core components
  • Wrap your app or feature area in a single DragDropContext with an onDragEnd callback
  • Define drop targets with Droppable and specify type for cross-list constraints
  • Mark items with Draggable and spread the provided props onto DOM elements
  • Use isDragDisabled on Draggable or isDropDisabled on Droppable for conditional control

Key Features

  • Accessibility-first: ARIA live regions, keyboard shortcuts, and screen reader guidance built in
  • Natural motion with spring physics and drop animation curves
  • Multi-list support for Kanban boards and column-based layouts
  • Auto-scrolling when dragging near container edges
  • Sensor API for programmatic drag triggers in tests and automation

Comparison with Similar Tools

  • dnd-kit — Newer, more flexible, and actively maintained; react-beautiful-dnd is in maintenance mode
  • react-dnd — Lower-level with backend adapters; requires more boilerplate for list reordering
  • SortableJS — Framework-agnostic but React wrapper is less idiomatic than rbd's render-prop API
  • Framer Motion layout — Animation-focused with drag support; not designed for multi-list reordering
  • @hello-pangea/dnd — Community fork of rbd with active development and React 18 support

FAQ

Q: Is react-beautiful-dnd still maintained? A: Atlassian moved the project to maintenance mode in 2023. For new projects, consider @hello-pangea/dnd (a maintained fork) or dnd-kit.

Q: Does it work with React 18? A: It works in most cases but has known issues with StrictMode. The @hello-pangea/dnd fork resolves these.

Q: Can I use it for grid layouts? A: It is optimized for lists. Grid reordering is possible but not a first-class use case; dnd-kit handles grids better.

Q: How do I persist the new order after a drop? A: In the onDragEnd callback, splice the source item into the destination index and update your state or send the new order to your backend.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires