1.0.3 • Published 1 year ago

woby-modal v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Woby-Modal

A woby modal with animations. A Rodal port

Example

Installation

pnpm add voby-modal --save

Usage

import { $, render } from 'woby'
import { Wodal } from 'woby-modal';

// include styles
import '../../dist/output.css'

const App = () => {
    const visible = $(false)

    const show = (v: string) => {
        animation(v)
        visible(true)
    }

    const hide = () => {
        visible(false)
    }

    return (
      <div>
        <button onClick={this.show.bind(this)}>show</button>

        <Wodal
            visible={visible}
            onClose={hide}
            animation={animation}
            closeOnEsc className='w-[50%] h-[25%]'
        >
            <div>Content</div>

            <button className="vodal-confirm-btn" onClick={hide}>
                ok
            </button>
            <button className="vodal-cancel-btn" onClick={hide}>
                close
            </button>
        </Wodal>
      </div>
    );
  }

render(<App />, document.getElementById('app'))

Props

PropertyTypeDefaultDescription
onClosefunc/handler called onClose of modal
onAnimationEndfunc/handler called onEnd of animation
visibleboolfalsewhether to show dialog
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
classNamestringw-50% h-25%className for the container
customStylesobject/custom styles
customMaskStylesobject/custom mask styles
idstring/id for dialog

Animation Types

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

Other

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

2 years ago