# bokuweb/react-rnd

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/bokuweb-react-rnd).**

4,278 stars · 335 forks · TypeScript · mit

## Links

- GitHub: https://github.com/bokuweb/react-rnd
- Homepage: https://bokuweb.github.io/react-rnd/stories
- awesome-repositories: https://awesome-repositories.com/repository/bokuweb-react-rnd.md

## Topics

`component` `drag` `draggable` `react` `resizable` `resize`

## Description

react-rnd is a JavaScript UI interaction library and React component used to create elements that are both draggable and resizable within a browser window. It functions as a constraint-based layout component that wraps DOM elements to enforce boundaries, grid snapping, and aspect ratio locks during manual adjustments.

The library allows for the definition of custom interaction handles to act as the primary triggers for dragging and resizing actions. It supports axis restrictions, boundary limits, and the ability to round position and dimension values to specified pixel increments.

The system provides event-driven tracking that triggers callbacks at the start, progression, and completion of movement or scaling. It manages the spatial state of elements through a hybrid of internal state and controlled properties to maintain precise layout control.

## Tags

### Part of an Awesome List

- [Draggable and Resizable React Components](https://awesome-repositories.com/f/awesome-lists/devtools/component-and-react-utilities/draggable-and-resizable-react-components.md) — Provides a React component that makes DOM elements draggable and resizable with boundary constraints.
- [Drag and Resize Functionality](https://awesome-repositories.com/f/awesome-lists/devtools/drag-and-drop/drag-and-resize-functionality.md) — Makes DOM elements movable by dragging and resizable by dragging edges or corners. ([source](https://cdn.jsdelivr.net/gh/bokuweb/react-rnd@master/README.md))

### Business & Productivity Software

- [Element Size Limits](https://awesome-repositories.com/f/business-productivity-software/note-editors/size-limiters/element-size-limits.md) — Clamps draggable and resizable element dimensions to user-defined minimum and maximum values. ([source](https://cdn.jsdelivr.net/gh/bokuweb/react-rnd@master/README.md))

### User Interface & Experience

- [Constraint Layout Engines](https://awesome-repositories.com/f/user-interface-experience/constraint-layout-engines.md) — Calculates component geometry based on dynamic constraints during drag and resize operations.
- [Aspect Ratio Constraints](https://awesome-repositories.com/f/user-interface-experience/constraint-layout-engines/aspect-ratio-constraints.md) — Enforces width-to-height proportions on UI elements during interactive resizing.
- [Draggable Resizable Placements](https://awesome-repositories.com/f/user-interface-experience/desktop-widgets/draggable-resizable-placements.md) — Creates interactive elements that users can freely move and resize within a browser window.
- [React Drag and Resize Libraries](https://awesome-repositories.com/f/user-interface-experience/drag-and-drop-libraries/react-drag-and-resize-libraries.md) — Provides a JavaScript library for creating interactive elements that support both dragging and resizing.
- [Programmatic Position and Size](https://awesome-repositories.com/f/user-interface-experience/element-positioning/programmatic-position-and-size.md) — Provides imperative methods to programmatically set element position and dimensions. ([source](https://cdn.jsdelivr.net/gh/bokuweb/react-rnd@master/README.md))
- [Drag Boundary Constraints](https://awesome-repositories.com/f/user-interface-experience/form-and-input-management/interaction-and-event-handling/drag-and-drop-interactions/drag-boundary-constraints.md) — Restricts dragging within a specified parent, window, body, or CSS selector boundary. ([source](https://cdn.jsdelivr.net/gh/bokuweb/react-rnd@master/README.md))
- [Drag Event Callbacks](https://awesome-repositories.com/f/user-interface-experience/form-and-input-management/interaction-and-event-handling/drag-operation-controls/drag-event-callbacks.md) — Fires callbacks at start, during, and after drag or resize operations with position and size data. ([source](https://cdn.jsdelivr.net/gh/bokuweb/react-rnd@master/README.md))
- [Grid Snapping](https://awesome-repositories.com/f/user-interface-experience/resizable-panes/grid-item-resizers/grid-snapping.md) — Snaps element position and size to configurable grid increments during drag and resize operations. ([source](https://cdn.jsdelivr.net/gh/bokuweb/react-rnd@master/README.md))
- [Constraint Based Layouts](https://awesome-repositories.com/f/user-interface-experience/styling-theming-systems/css-layout-systems/constraint-based-layouts.md) — Enforces boundaries, grid snapping, and aspect ratio locks on draggable and resizable elements.
- [Drag Handles](https://awesome-repositories.com/f/user-interface-experience/form-and-input-management/interaction-and-event-handling/drag-operation-controls/drag-handles.md) — Restricts dragging to only initiate when the user grabs a specific child element by class name. ([source](https://cdn.jsdelivr.net/gh/bokuweb/react-rnd@master/README.md))
- [Drag Direction Restrictions](https://awesome-repositories.com/f/user-interface-experience/form-and-input-management/interaction-and-event-handling/drag-operation-controls/drag-handles/drag-direction-restrictions.md) — Limits dragging to only horizontal, only vertical, both, or none. ([source](https://cdn.jsdelivr.net/gh/bokuweb/react-rnd@master/README.md))
- [Drag-and-Drop Event Callbacks](https://awesome-repositories.com/f/user-interface-experience/form-and-input-management/interaction-and-event-handling/interaction-logic-hooks/interaction-handlers/drag-and-drop-event-callbacks.md) — Chains start, move, and end callbacks for drag and resize actions.
- [Element Resizers](https://awesome-repositories.com/f/user-interface-experience/resizable-panes/element-resizers.md) — Updates the size or position of draggable and resizable elements from code using imperative methods.

### Development Tools & Productivity

- [Custom Resize Handles](https://awesome-repositories.com/f/development-tools-productivity/window-managers/interactive-window-manipulation/interactive-resizers/custom-resize-handles.md) — Routes resize actions through user-defined React components or CSS selectors.

### Scientific & Mathematical Computing

- [Grid Snapping Arithmetic](https://awesome-repositories.com/f/scientific-mathematical-computing/numerical-mathematical-foundations/arithmetic-number-types/multiplication-algorithms/number-theory-algorithms/modular-arithmetic-classes/grid-snapping-arithmetic.md) — Rounds position and dimension values to the nearest grid increment during movement or scaling.

### Software Engineering & Architecture

- [Hybrid State Management](https://awesome-repositories.com/f/software-engineering-architecture/state-management-architectures/hybrid-state-management.md) — Maintains internal spatial state for responsive interactions while exposing controlled properties.
