🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

react-rnd

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-rnd

A draggable and resizable React Component

10.5.2
latest
Source
npm
Version published
Weekly downloads
290K
2.63%
Maintainers
1
Weekly downloads
 
Created

What is react-rnd?

The react-rnd package is a React component that allows you to create resizable and draggable elements. It is highly customizable and can be used to build complex user interfaces with ease.

What are react-rnd's main functionalities?

Draggable

This feature allows you to make any element draggable. The code sample demonstrates how to create a draggable component with default position and size.

import Rnd from 'react-rnd';

function DraggableComponent() {
  return (
    <Rnd
      default={{ x: 0, y: 0, width: 320, height: 200 }}
    >
      <div style={{ border: '1px solid black', padding: '10px' }}>
        Draggable Content
      </div>
    </Rnd>
  );
}

Resizable

This feature allows you to make any element resizable. The code sample demonstrates how to create a resizable component with resizing enabled on all sides and corners.

import Rnd from 'react-rnd';

function ResizableComponent() {
  return (
    <Rnd
      default={{ x: 0, y: 0, width: 320, height: 200 }}
      enableResizing={{ top: true, right: true, bottom: true, left: true, topRight: true, bottomRight: true, bottomLeft: true, topLeft: true }}
    >
      <div style={{ border: '1px solid black', padding: '10px' }}>
        Resizable Content
      </div>
    </Rnd>
  );
}

Draggable and Resizable

This feature allows you to make any element both draggable and resizable. The code sample demonstrates how to create a component that can be dragged and resized.

import Rnd from 'react-rnd';

function DraggableResizableComponent() {
  return (
    <Rnd
      default={{ x: 0, y: 0, width: 320, height: 200 }}
      enableResizing={{ top: true, right: true, bottom: true, left: true, topRight: true, bottomRight: true, bottomLeft: true, topLeft: true }}
    >
      <div style={{ border: '1px solid black', padding: '10px' }}>
        Draggable and Resizable Content
      </div>
    </Rnd>
  );
}

Other packages similar to react-rnd

Keywords

react

FAQs

Package last updated on 26 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts