0.0.5 • Published 3 years ago

@cig/modal v0.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

@cig/select

The Modal control for React.

Demo

https://codesandbox.io/s/cig-modal-4f487

Installation and usage

The easiest way to use @cig/modal is to install it from npm and build it into your app with Webpack.

npm i -S @cig/modal

Then use it in your App:

import React, {
  useState,
  useEffect,
} from 'react'
import Modal from '@cig/modal'

export default () => {
  const [show, setShow] = useState(false)

  useEffect(() => console.log(show), [show])

  return (
    <>
      <div
        onClick={() => setShow(true)}
        role="button"
        onKeyUp={() => {}}
        tabIndex={0}
      >
        <p>click show modal</p>
      </div>
      <Modal
        show={show}
        content="hello world"
        onChange={() => setShow(false)}
      />
    </>
  )
}

Props

名称类型必填默认值描述
showBooleanYfalse展示
contentStringY-提示文字
onChangeFunctionY-确定按钮回调