0.0.0 • Published 2 years ago

react-resizable-modal v0.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

react-rnd-modal

Installation

React 16.8+

npm i react-resizeable-modal

Usage

import React, { useState } from 'react'
import Modal from 'react-resizeable-modal'

// include styles
import 'react-resizeable-modal/style/index.css'

function App() {
  const [visible, setVisible] = useState<boolean>(false)

  return (
    <div>
      <button onClick={() => setVisible(true)}>show</button>
      <Modal visible={visible} onClose={() => setVisible(false)}>
        <div>Content</div>
      </Modal>
    </div>
  )
}

Props

PropertyTypeDefaultDescription
widthnumber-width of panel
heightnumber-height of panel
measurestringpxmeasure of width and height
onClosefunction/handler called onClose of modal
onAnimationEndfunction/handler called onEnd of animation
visibleboolfalsewhether to show panel
showMaskbooltruewhether to show mask
closeOnEscboolfalsewhether close dialog when esc pressed
closeMaskOnClickbooltruewhether close dialog when mask clicked
showCloseButtonbooltruewhether to show close button
animationstringzoomanimation type
enterAnimationstring/enter animation type (higher order than 'animation')
leaveAnimationstringleave animation type (higher order than 'animation')
durationnumber300animation duration
classNamestring/className for the container
customStylesobject/custom styles for the container
customMaskStylesobject/custom mask styles for mask layer

Animation Types

  • zoom
  • fade
  • flip
  • door
  • rotate
  • slideUp
  • slideDown
  • slideLeft
  • slideRight
0.0.0

2 years ago