@cig/modal

0.0.5 • Public • Published

@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

名称 类型 必填 默认值 描述
show Boolean Y false 展示
content String Y - 提示文字
onChange Function Y - 确定按钮回调

Readme

Keywords

Package Sidebar

Install

npm i @cig/modal

Weekly Downloads

2

Version

0.0.5

License

ISC

Unpacked Size

3.53 kB

Total Files

4

Last publish

Collaborators

  • wu1989
  • loseyear
  • marken