0.0.3 • Published 7 months ago

react-resizable-draggable-modal v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

react-resizable-draggable-modal

Resizable draggable modal based on React hooks.

Install

npm i react-resizable-draggable-modal

Usage:

In your React component:
import ResizableDraggableModal from 'react-resizable-draggable-modal'
import 'react-resizable-draggable-modal/build/style.css'

<ResizableDraggableModal
  title='My Modal'
  visible={modalIsOpen}
  onClose={closeModal}
  onOk={closeModal}
>
  <div className='body'>
    <p>This is the modal body.</p>
  </div>
</ResizableDraggableModal>

Supported props

PropertyDescriptionTypeDefault
leftInit left of the Modalnumber
topInit top of the Modalnumber
initWidthinit Width of the Modalnumber600
initHeightinit Height of the Modalnumber400
minWidthMinimum width when draggingnumber300
minHeightMinimum height when draggingnumber200
resetRectOnOpenWhen opening the modal, whether to reset rect(position and size)boolean
draggableIs it draggablebooleantrue
resizableIs it resizablebooleantrue
verticalResizableIs it resizable in the vertical direction?booleantrue
horizontalResizableIs it resizable in the horizontal direction?booleantrue
overflowBoundaryBehavior beyond the parent container's boundariesauto or hiddenauto
maskWhether show mask or notbooleantrue
maskClosableWhether to close the Modal when the mask (area outside the modal) is clickedboolean
visibleIs the modal open?boolean
getPopupContainerTo set the container of the Modal. The default is to create a div element in body, but you can reset it to the scrolling area and make a relative reposition.function() => document.body
classNameThe class name of the modalstring
titleThe title of the modalstringtitle
onDragDragging the Modal is triggeredfunction
onResizeDragging the Modal is triggeredfunction
footerFooter content, set as footer={null} when you don't need default buttonsReactNode
onCloseClick the cancel button on the left side of the footerfunction
onOkClick the ok button on the right side of the footerfunction
0.0.3

7 months ago

0.0.2

10 months ago

0.0.1

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago