React component that makes elements draggable and resizable, with controlled or default position and size, resize handles, grids, bounds, and drag-axis options.
Overview
React Rnd is a React library that wraps child content in a box users can drag and resize in the browser. It combines dragging and resizing in one component for dashboards, floating panels, editors, and layouts that need direct manipulation.
Default or controlled position and size accept pixel values, percentages, or auto sizing. Resize can be limited per edge and corner, with optional minimum and maximum dimensions, aspect-ratio locking, and snap grids for move and resize steps. Dragging can use a dedicated handle class, be disabled entirely, or restrict movement to an axis; bounds can tie movement to a parent, the window, or a selector.
Styling hooks cover the wrapper, resize handles, and custom handle components. Callbacks fire on drag and resize start, during interaction, and on stop. Imperative methods update size or position programmatically, ignoring grid bounds when position is updated directly.
The package builds on react-draggable and re-resizable. Storybook and CodeSandbox examples document common setups, including TypeScript and hooks-based usage.
Key features
- Drag and resize together
- Controlled position and size
- Per-edge resize control
- Aspect ratio lock
- Drag and resize grids
- Movement bounds
- Custom resize handles
- Drag handle selector
Use cases
- Floating dashboard panels
- Resizable editor panes
- Movable overlay windows
- Visual layout builders
- Interactive canvas widgets